Click here to Skip to main content
15,892,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Controls in CPaneDialog (MFC) not Working Pin
Victor Nijegorodov23-Aug-16 3:37
Victor Nijegorodov23-Aug-16 3:37 
QuestionRe: Controls in CPaneDialog (MFC) not Working Pin
David Crow23-Aug-16 6:04
David Crow23-Aug-16 6:04 
AnswerRe: Controls in CPaneDialog (MFC) not Working Pin
Member 853403527-Aug-16 1:31
Member 853403527-Aug-16 1:31 
AnswerRe: Controls in CPaneDialog (MFC) not Working Pin
Couvert Gérard8-Feb-22 1:45
Couvert Gérard8-Feb-22 1:45 
GeneralRe: Controls in CPaneDialog (MFC) not Working Pin
Klaus Bucher20-Apr-22 23:57
Klaus Bucher20-Apr-22 23:57 
QuestionOwner Draw Static Control Freezes up application Pin
ForNow14-Aug-16 5:55
ForNow14-Aug-16 5:55 
AnswerRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
ForNow14-Aug-16 7:31
ForNow14-Aug-16 7:31 
GeneralRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
leon de boer15-Aug-16 21:11
leon de boer15-Aug-16 21:11 
MFC is weird in a number of areas it isn't equivalent to the WIN32 API in a great many respects.

You have run across this a number of times with things like it is a singular thread, it's modal dialogs are in fact not WIN32 modal in MFC they become modal via the message loop. You seem to have identified MFC static text has got some different behaviour as well.

The thing about SS_OWNERDRAW on a true Win32 static class is you don't override it on the static itself but rather the dialog owner is sent the WM_DRAWITEM message and it is expected to handle it for the static class

In the Win32 framework it is very explicit
About Static Controls (Windows)[^]
By using the SS_OWNERDRAW style, an application can take responsibility for painting a static control. The parent window of an owner-drawn static control (its owner) receives a WM_DRAWITEM message whenever the static control needs to be painted. The message includes a pointer to a DRAWITEMSTRUCT structure that contains information that the owner window uses when drawing the control. 

My biggest reason for not ever using MFC is that you can't mix pure Win32 code with MFC easily and reliably. The newer WPF framework allows Win32 Interoperation with only a limited few restrictions. For example in your case it would have been nice to have just written a nice pure Win32 dialog code to do what you want but MFC can't call a native Win32 dialog process because it has its own message pump loop and it's dialogs aren't really modal.

If you want to look at the message pump which is very MFC specific goto CWnd::RunModalLoop function and you can see how it pumps messages into the framework via
AfxGetThread()->PumpMessage()

If you are using MFC you need to ignore native Win32 it won't always work. Probably use it as a guide as how it might work if MFC not as how you should do it on MFC. From you prior answer it is also obvious MFC window frames aren't exactly like Win32 native frame either.

If your project isn't large I think you have now reached a level of understanding of Win32 you could dispense with the MFC framework and just have a pure Win32 application. You seem to spend more time fighting the framework than actually coding new stuff. So the question I would put to you would be what do you like about the MFC framework, what positives do you have.
In vino veritas


modified 16-Aug-16 3:49am.

GeneralRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
Richard MacCutchan15-Aug-16 23:57
mveRichard MacCutchan15-Aug-16 23:57 
GeneralRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
ForNow16-Aug-16 2:02
ForNow16-Aug-16 2:02 
GeneralRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
Richard MacCutchan16-Aug-16 3:00
mveRichard MacCutchan16-Aug-16 3:00 
GeneralRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
ForNow16-Aug-16 3:04
ForNow16-Aug-16 3:04 
GeneralRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
David Crow16-Aug-16 4:07
David Crow16-Aug-16 4:07 
GeneralRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
Richard MacCutchan16-Aug-16 5:27
mveRichard MacCutchan16-Aug-16 5:27 
GeneralRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
leon de boer16-Aug-16 3:37
leon de boer16-Aug-16 3:37 
GeneralRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
ForNow16-Aug-16 3:59
ForNow16-Aug-16 3:59 
GeneralRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
David Crow16-Aug-16 9:51
David Crow16-Aug-16 9:51 
GeneralRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
ForNow16-Aug-16 9:56
ForNow16-Aug-16 9:56 
QuestionRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
David Crow16-Aug-16 10:20
David Crow16-Aug-16 10:20 
AnswerRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
ForNow16-Aug-16 10:24
ForNow16-Aug-16 10:24 
QuestionRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
David Crow16-Aug-16 10:29
David Crow16-Aug-16 10:29 
AnswerRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
ForNow16-Aug-16 10:37
ForNow16-Aug-16 10:37 
GeneralRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
leon de boer17-Aug-16 14:17
leon de boer17-Aug-16 14:17 
GeneralRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
ForNow17-Aug-16 14:34
ForNow17-Aug-16 14:34 
GeneralRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
Richard MacCutchan17-Aug-16 21:31
mveRichard MacCutchan17-Aug-16 21:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.