|
Adam/Cedric, Thank you for your advice ! All fixed now - put it down to ignorance !!
Doug
|
|
|
|
|
Hi,
I have developed a SDI application and split it into two parts. One part is simple view and another part is form view, in which i have select a dialog as child.
My problem is, I can't change the background of dialog and some 'static text' controls color.
I have used
SetDialogBkColor(RGB(255, 0, 0), RGB(0, 255, 0));
in app class. But its not working.
Pls hlp.
Thanks in advanced
|
|
|
|
|
To change the color of a static control do that in WM_CTLCOLOR [^]message
|
|
|
|
|
Hi,
Not only controls color, but also want to change the background color
|
|
|
|
|
m_mun wrote: want to change the background color
Create a solid brush in FormView's OnInitialUpdate m_wndbkBrush.CreateSolidBrush(RGB(0,255,0)); , and use this in OnEraseBkgnd overload of FormView.
void CxxxFormView::OnEraseBkgnd(CDC* pDC)
{
CFormView::OnEraseBkgnd(pDC);
CRect rect;
GetClientRect(rect);
pDC->FillRect(&rect, &m_wndbkBrush);
return TRUE;
}
modified on Monday, December 7, 2009 5:09 AM
|
|
|
|
|
Thanks, it changes the background color
modified on Monday, December 7, 2009 5:52 AM
|
|
|
|
|
Whenever i scroll down, the other portion does not changes. How can i do that?
I have used
void Cxxx::OnDraw(CDC* pDC)
{
CFormView::OnEraseBkgnd(pDC);
CRect rect;
GetClientRect(rect);
pDC->FillRect(&rect, &m_wndbkBrush);
return;
}
|
|
|
|
|
Madhu already mentioned that you must do this in OnEraseBkgnd instaed of OnDraw()
-Sarath.
Rate the answers and close your posts if it's answered
|
|
|
|
|
m_mun wrote: CFormView::OnEraseBkgnd(pDC);
You do not call this within OnDraw() .
"One man's wage rise is another man's price increase." - Harold Wilson
"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 have created a new class for form view. There is no msg handler for OnEraseBkgnd
|
|
|
|
|
m_mun wrote: There is no msg handler for OnEraseBkgnd
OnEraseBkgnd() is the message handler for WM_ERASEBKGND .
"One man's wage rise is another man's price increase." - Harold Wilson
"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
|
|
|
|
|
Yes, but it is not displayed
|
|
|
|
|
As Madhu mentioned, WM_CTLCOLOR is not only for controls, but also for the dialog.
When the wParam is CTLCOLOR_DLG , you can return a brush for dialog box color.
Please read the documentation. It says it all.
|
|
|
|
|
i created a project which based win32, and i'll plan to create a mfc-dll for calling in win32, could this idea be implemented?
can you give me some similar code or related articles, thank you very much!
|
|
|
|
|
I guess you can call an MFC DLL from a Win32 application.
You should actually try it.
|
|
|
|
|
nenfa wrote: can you give me some similar code or related articles
Here is a sample article for calling a dll function[^] in C++
|
|
|
|
|
thank you, but it can fit my request, i real demand is to use controls like CSlider which are implemented in MFC-Dll
|
|
|
|
|
i have defined the macro which names M_DEBUG(str, msg),
now i want to rename the M_DEBUG for special usage, and i do like this:
#define _M_DEBUG(str, msg) M_DEBUG(str, msg)
but it happens that "_M_DEBUG" : undeclared identifier, why?
|
|
|
|
|
sorry, it can do!
i just used error macro-name
|
|
|
|
|
Does anyone know the fix for Windows Explorer when dealing with setting (re-setting) permissions?
I've changed this folder numerous times from Read Only clicked the applied button selected the applied to sub-folders and files. But when I again check it it is again Read Only. How do you fix this? I checked the Security tab and "Full Control" is under all available selections. What is stopping my selections?
A C++ programming language novice, but striving to learn
|
|
|
|
|
It is probably also a system folder which is why you're not able to remove its read only property.
If it is a system folder, it is not a good idea to change its attributes.
However, if you still want to change it, here is something you can try.
Open a command prompt with elevated privileges and change to the folder.
Try the command attrib -r -s *.* /S /D
|
|
|
|
|
Hi, I would like to do the following:
Allocate datas in a dll and then free them in the main application.
I have read there are potentials problems doing this because dll and process don't share the same memory, it depends on the compiler,... don't do this - ok.
So I was looking for a solution and I went accross the Heap functions.
It seems that when I allocate memory like this:
HeapAlloc(GetProcessHeap(),... the default Heap is used to store the memory. Then the dll and my application will share the same Heap for that data.
So they share the same Heap, but I still wonder if it safe is to call HeapAlloc from the dll and HeapFree from the application for the same data ?
Any idea ?
Yarp
http://www.senosoft.com/
|
|
|
|
|
why can't you provide your own FreeMyDllObject() funtion inside the DLL, matching the way your DLL code allocates its stuff. Then the caller doesn't have to know the messy details, and there is less dependency between EXE and DLL. Later on, you could even change your DLL's memory management without changing the EXE at all.
|
|
|
|
|
Hi Luc,
There are various situations and memory is not always allocated in the same place.
I have got 3 different case:
- a DIB allocated in main thread and used in the dll
- a DIB loaded in a thread used in the dll
- a DIB loaded in a dll used in main thread
I would need 3 different FreeMyObject for a unique DIB class while this HeapAlloc / HeapFree possible solution is common, and as simple as new / delete.
I see it as a great simplification. Provided it is reliable on all systems.
Thanks for your answer.
Yarp
http://www.senosoft.com/
|
|
|
|
|
I have implemented a small web server inside a dialog application that host the web browser control.
On a good scenario, this is what happens: I pass the url to the webbrowser control and it downloads all files from my server and displays it correctly. Something like:
CString navigateTo;
navigateTo.Format((TEXT("http://127.0.0.1:%d/%s")), m_nListeningSocketPort, GetFileName() );
try {
m_IExplorer.Navigate( navigateTo, 0, 0, 0, 0 );
}
...
explorer then gets all the files needed from the web server and all is ok. Then I disconnect from internet and from that point on internet explorer doesn't download anything. It doesnt even try to contact the server!
Events go like this:
http:
BeforeNavigate2Webbrowser()
DownloadBeginWebbrowser()
DownloadBeginWebbrowser()
DownloadBeginWebbrowser()
DownloadBeginWebbrowser()
NavigateErrorWebbrowser():: URL: http:
BeforeNavigate2Webbrowser():: URL: res:
DownloadBeginWebbrowser()
DownloadBeginWebbrowser()
NavigateComplete2Webbrowser():: URL: http:
NavigateError() reports INET_E_DOWNLOAD_FAILURE. Can anyone explain what's going on? How can I force the web browser to contact to local web server? I implemented additinal test to verify server is up and running, and it's all good.
|
|
|
|