|
Dear Randor,
Once again thank you for your great help. That did the Trick! I have one more issue in the static text. It doesn't properly update the text. I think it is writing over the old text in each iteration. I am using a static text to display the current time. In each second it is being updated with new time with the help of a timer. It was working fine before we went for the transparent background. now it seems to be overwriting. Do I need to clear the text before updating it? I mean use some thing like
SetDlgItemText(IDC_STATIC_DATE,_T(" ")
SetDlgItemText(IDC_STATIC_DATE,_T("HH:MM:SS")
Thank you
Deepak
|
|
|
|
|
Hi Deepak,
Are you Invalidating the CStatic window after you update the text?
SetDlgItemText(IDC_STATIC_DATE,_T("HH:MM:SS"));
CWnd *pWnd = GetDlgItem(IDC_STATIC_DATE);
if(NULL != pWnd)
{
pWnd->Invalidate();
pWnd->UpdateWindow();
}
Best Wishes,
-David Delaune
|
|
|
|
|
Randor wrote: Invalidating the CStatic window
Hi David,
That has no effect.
Thanks
Deepak
|
|
|
|
|
Sorry... I somehow misunderstood what your trouble was.
Now I understand your problem. The parent needs to redraw what was under the child something like this:
CWnd *pWnd = GetDlgItem(IDC_STATIC_DATE);
if(NULL != pWnd)
{
RECT r;
pWnd->GetWindowRect(&r);
ScreenToClient(&r);
InvalidateRect(&r);
}
Best Wishes,
-David Delaune
|
|
|
|
|
Hi David,
It is working nicely now.
But I could not set text colour for the Check boxes and Radio buttons. IT shows up as black always regardless of SetTextColor(). Is there any other thing I have to do in CtlColor method for it? Also how to control the colour of Tab control ?
Thank You
Deepak
|
|
|
|
|
Hi Deepak,
This tells me that your Windows theme is overriding the colors. You can disable the theme for an individual control using the SetWindowTheme Function[^]. Lets use your checkbox as an example:
case IDC_YOUR_CHECKBOX:
{
RECT r;
pWnd->GetClientRect(&r);
pDC->BitBlt(0, 0, r.right - r.left, r.bottom - r.top, pWnd->GetDC(), r.left, r.top, SRCCOPY);
pDC->SetBkMode(TRANSPARENT);
hbr = ((HBRUSH)GetStockObject(NULL_BRUSH));
pDC->SetTextColor(RGB(255, 0, 0));
SetWindowTheme(pWnd->m_hWnd, L"", L"");
break;
}
We have disabled the theme on this control. It might not be what you want, maybe it will be ugly in your eyes.
Best Wishes,
-David Delaune
|
|
|
|
|
Compiler complained that
Error 1 error LNK2001: unresolved external symbol __imp__SetWindowTheme@12 LoggerDlg.obj
Error 2 fatal error LNK1120: 1 unresolved externals C:\Documents and Settings\deepak.p\Desktop\Logger Working\Logger 13-Sep-2009
From the documentation you provided it says to include "uxtheme.h" but it din't solved the compile error.
Do we need any other includes ?
|
|
|
|
|
Add:
#include "uxtheme.h"
#pragma comment(lib, "uxtheme.lib")
Or you can add the uxtheme.lib into the project linker settings.
Best Wishes,
-David Delaune
|
|
|
|
|
Dear David,
Sorry for the late reply. I was on leave due to some health problems
I tried your suggestion for the check boxes. But it shows some strange behaviors. Okay I will go with the black letters. But can you please tell me how to change the Tab controls color and button colors?
Thanks in advance
Deepak
|
|
|
|
|
Can we access session cookies from C++/VC++ code.
How to do that?
I need to store data in session cookies when I open any web based client, and I need to access the cookies from VC++ code, I need help in that whether we can
Do that? Please somebody can let me know how to do that if there is any solution.
Thank you in advance.
|
|
|
|
|
Are you wanting to do it via a BHO, or are you just wanting to open the .txt file?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I am hosting web browser on a dialog( which is MFC dialog) and navigating to a link ( link ->which is a client to a database of articles)
when I open an article in the browser which I hosted on MFC dialog I will save the article id ( somehow I will get it ) in a session cookie.
Later on I need to access the session cookie from MFC code.
how to do that any idea please?
I am using CWebBrowser2 calss object as web browser, and useing CWebBrowser2 ::Navigate2 interface method to navigate to the specified link.
modified on Wednesday, September 16, 2009 1:01 PM
|
|
|
|
|
sarat wrote: ...I will save the article id ( somehow I will get it ) in a session cookie.
Later on I need to access the session cookie from MFC code.
how to do that any idea please?
If you have code for creating a cookie, why can't you access it?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I create cookeies thru .aspx page and post it to local machine with another .aspx page. the code is in aspx now i need to access the cookies from MFC code
|
|
|
|
|
See here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thanx a lot DavidCrow,
in that post , i do not understand how to create m_piRequest object
before making a call "hr = m_piRequest->get_Cookies(&pDict);"
i am not that familier with COM.
I googled it : m_piRequest is The IRequest interface pointer ( if am not wrong)
please let me know how to create m_piRequest object before start using it,
do i need to do cocreate instance?
please help me in this.
basically.. i am hosting CWebBrowser2 derived class object on a dialog.
and using Navigate funtion to navigate to any URL of a web application.
I will be createing cookies thru aspx page of the webapplication.
|
|
|
|
|
sarat wrote: I googled it : m_piRequest is The IRequest interface pointer ( if am not wrong)
That is correct.
sarat wrote: please let me know how to create m_piRequest object before start using it,
do i need to do cocreate instance?
please help me in this.
See here and here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thank you DavidCrow
I am enjoing learning COM..with ur help.
but the problem in here is , i donot have "OnStartPage" function and noway it gets called in my application.
i have a dialog on that i am hosting a CwebBrowser2 derived class object.
i have a button called insert article.
when i click on insertarticle button i need to access the cookie.
( When i open any article on the browser, one file called article.aspx will create cookie and assignes article id as its value, which i need to access when i cleick on insert button )
i do not have OnStartPage () function here and cannot get IUnknown* pUnk.
what is the solution for the problem.. please help me in this
|
|
|
|
|
My class which cooperates with MS Acces base looks like below:
In doted place I removed code as a not relevant for case:
Problem is that field mTekst in Acces is set as Memo type. And I wish
to place long report texts in.
My class can't transfer longer text then 255 chars otherwise it shows
an error. Temporarily I deal with it by cutting part of chars.
(Look in function LeftF()) . But a program is not functionally then.
What can I do to deal with problem? Help
1. IMPLEMENT_DYNAMIC(mRec, CRecordset)
2.
3. mRec::mRec(CDatabase* pdb): CRecordset(pdb)
4. {
5. //{{AFX_FIELD_INIT(mRec)
6. // ......
7. m_Temat = _T(""); //
8. // ........
9. //}}AFX_FIELD_INIT
10. m_nDefaultType = snapshot;
11. }
12.
13.
14. CString mRec::GetDefaultConnect()
15. {
16. return _T("ODBC;DSN=mbasa"); // mbasa it is my base in MS
17. Acces
18. }
19.
20. CString mRec::GetDefaultSQL()
21. {
22. return _T("[mHeapTb]"); // mHeapTB it is my table in in
23. my base
24. }
25.
26. void mRec::DoFieldExchange(CFieldExchange* pFX)
27. {
28. //{{AFX_FIELD_MAP(mRec)
29. pFX->SetFieldType(CFieldExchange::outputColumn);
30. ..........
31. RFX_Text(pFX, _T("[mTekst]"), m_mTekst); //mTekst it is
32. field in Table
33. ...........
34. //}}AFX_FIELD_MAP
35. }
36.
37. // Here are my functions
38.
39. CString mRec::GetmTekst(int i)
40. {
41. InterriroF(i);
42.
43. return m_mTekst;
44. }
45. //.................................
46.
47. void mRec::InterriroF(int i)
48. {
49. if(Open(AFX_DB_USE_DEFAULT_TYPE,"SELECT * FROM mHeapTb",readOnly))
50. {
51. try
52. {
53. SetAbsPos (i);
54. }
55. catch(CDBException * e)
56. {
57. LeftF();
58. e->Delete();
59.
60.}
61. Close() ;
62. }
63. }
64.
65. //................
66.
67.
68. void mRec::SetTekst(CString mTxt,int i)
69. {
70. if(Open(AFX_DB_USE_DEFAULT_TYPE,"SELECT * FROM mHeapTb",none))
71. {
72. SetAbsPos(i);
73. Edit();
74. if(mTxt.GetLength()>255)
75. mTxt=mTxt.Left(255);
76. mTxt=mTxt;
77. Update();
78. Close();
79. }
80. }
81. //........................
82.
83.
84. void mRec::SetAbsPos(int i)
85. {
86. try
87. {
88. SetAbsolutePosition (i);
89. }
90. catch(CDBException * e)
91. {
92. LeftF();
93. e->Delete();
94. }
95. }
96.
97. void mRec::LeftF()
98. {
99. if (m_mTekst.GetLength()>255)
100. m_mTekst= m_mTekst.Left(255);
101.
102. }
|
|
|
|
|
Rafix111 wrote: My class can't transfer longer text then 255 chars otherwise it shows
an error.
What error? I believe that is a limitation of a Text field in Access. Consider a Memo field instead.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Field in Access is set as Memo.
When is put more then 255 characters an error appears:
"Error: field address (column 2) has changed!"
and shows assertion info
Debug Assertion Failed
.....
File:dbrfx.cpp
Line 287
It happens while program executes Update() function.
|
|
|
|
|
Rafix111 wrote: It happens while program executes Update() function.
The actual assertion is line 287 of dbrfx.cpp in the CFieldExchange::Default() method. You might want to step into that code to see why the field's address is changing.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
It seems to me that the error can cause code (line 1008 in DBRFX.CPP file):
............
pFX->Default(szName, &value, plLength,
SQL_C_CHAR, value.GetLength(), nMaxLength);
..........
While debbuging program nMaxLength has value 255, but I do not know where gets it from.
And what can I do.
|
|
|
|
|
Hi,
is there any way to set property of a folder as zip-folder?
I create a new folder using CreateDirectory() for some data from my program, and set this folder as compressed, now i need to set this same folder as zipped folder!!
I don't want to create first a zip file and add some files to them, i create a compressed folder with CreateDirectory() and add some files to them,
and now i like to set them as compressed(zipped), is there any way how to do this?? Any idea how to do this??
Thanks for any help!
Arrin
|
|
|
|
|
Feel free to correct me but...
There is no such thing as a "zip-folder".
There are normal directories, and NTFS can compress files in it. You gain space, and lose time.
There are zip files. Explorer very kindly has an already installed shell extension which makes them look a lot like a directory. Explorer is lieing to you, in the interests of ease of use. This is good.
I can't really help you, as it sounds like you already know how to do this, you just don't like it.
Did that make sense?
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|