Click here to Skip to main content
14,975,862 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to test a synchronization object for lock? Pin
Jochen Arndt18-Aug-16 22:06
professionalJochen Arndt18-Aug-16 22:06 
QuestionControls in CPaneDialog (MFC) not Working Pin
Member 853403517-Aug-16 22:06
MemberMember 853403517-Aug-16 22:06 
AnswerRe: Controls in CPaneDialog (MFC) not Working Pin
Victor Nijegorodov23-Aug-16 3:37
MemberVictor Nijegorodov23-Aug-16 3:37 
QuestionRe: Controls in CPaneDialog (MFC) not Working Pin
David Crow23-Aug-16 6:04
MemberDavid Crow23-Aug-16 6:04 
AnswerRe: Controls in CPaneDialog (MFC) not Working Pin
Member 853403527-Aug-16 1:31
MemberMember 853403527-Aug-16 1:31 
QuestionOwner Draw Static Control Freezes up application Pin
ForNow14-Aug-16 5:55
MemberForNow14-Aug-16 5:55 
AnswerRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
ForNow14-Aug-16 7:31
MemberForNow14-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
Memberleon 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
MemberForNow16-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
MemberForNow16-Aug-16 3:04 
GeneralRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
David Crow16-Aug-16 4:07
MemberDavid 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
Memberleon 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
MemberForNow16-Aug-16 3:59 
GeneralRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
David Crow16-Aug-16 9:51
MemberDavid Crow16-Aug-16 9:51 
GeneralRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
ForNow16-Aug-16 9:56
MemberForNow16-Aug-16 9:56 
QuestionRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
David Crow16-Aug-16 10:20
MemberDavid Crow16-Aug-16 10:20 
AnswerRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
ForNow16-Aug-16 10:24
MemberForNow16-Aug-16 10:24 
QuestionRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
David Crow16-Aug-16 10:29
MemberDavid Crow16-Aug-16 10:29 
AnswerRe: Owner Draw Static Control Freezes up application removed message map problem solved Pin
ForNow16-Aug-16 10:37
MemberForNow16-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
Memberleon 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
MemberForNow17-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.