Click here to Skip to main content
15,861,125 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Vector as function return Pin
Richard MacCutchan9-Aug-16 20:57
mveRichard MacCutchan9-Aug-16 20:57 
QuestionAdding Text to the Frame Of a Dialog Pin
ForNow9-Aug-16 4:39
ForNow9-Aug-16 4:39 
AnswerRe: Adding Text to the Frame Of a Dialog Pin
jeron19-Aug-16 8:33
jeron19-Aug-16 8:33 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
ForNow9-Aug-16 13:07
ForNow9-Aug-16 13:07 
AnswerRe: Adding Text to the Frame Of a Dialog Pin
leon de boer9-Aug-16 19:05
leon de boer9-Aug-16 19:05 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
ForNow10-Aug-16 3:47
ForNow10-Aug-16 3:47 
SuggestionRe: Adding Text to the Frame Of a Dialog Pin
David Crow10-Aug-16 5:41
David Crow10-Aug-16 5:41 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
leon de boer10-Aug-16 17:07
leon de boer10-Aug-16 17:07 
As always MSDN is the authoritive answer on that

WM_NCPAINT message (Windows)[^]

Quote: "The wParam value can be passed to GetDCEx as in the following example."

You need GetWindowLongPtr with index DWLP_DLGPROC to get the current dialog handler which you probably hold from WM_INITDIALOG. You use CallWindowProc with the held original handler to call the original handler when you need it. Can I offer you a routine to Safely get the dialog procedure because you can get caught with unicode/non unicode dialog windows, that is determined by the function called in the dialog creation and you can have both in the same application.

 WNDPROC SafeGetDialogProc(HWND hwnd)
{
    if(IsWindowUnicode(hwnd))
        return (WNDPROC)GetWindowLongPtrW(hwnd, DWLP_DLGPROC);
    else
        return (WNDPROC)GetWindowLongPtrA(hwnd, DWLP_DLGPROC);
}


In your case you will call the old handler from within NC_PAINT and then do your special drawing routines over what they did and return zero as is required as you processed the call.
Here is a code hack to start with (the handler should really only be retrieved once at WM_INITDIALOG just for speed)
case WM_NCPAINT: {
         WNDPROC OldHandler = SafeGetDialogProc(hwnd);    // Get dialog handler
         CallWindowProc(OldHandler, hwnd, Msg, wParam, lParam);  // Call old handler
         
         // Do your special draw stuff

         return(0);   // Return zero
     }

In vino veritas


modified 10-Aug-16 23:36pm.

GeneralRe: Adding Text to the Frame Of a Dialog Pin
ForNow10-Aug-16 20:31
ForNow10-Aug-16 20:31 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
leon de boer11-Aug-16 3:00
leon de boer11-Aug-16 3:00 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
ForNow11-Aug-16 3:18
ForNow11-Aug-16 3:18 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
ForNow11-Aug-16 2:58
ForNow11-Aug-16 2:58 
AnswerRe: Adding Text to the Frame Of a Dialog Pin
Richard MacCutchan9-Aug-16 20:49
mveRichard MacCutchan9-Aug-16 20:49 
Questionconst "getter" but updating on request? Pin
FriendOfAsherah8-Aug-16 21:20
FriendOfAsherah8-Aug-16 21:20 
AnswerRe: const "getter" but updating on request? Pin
Jochen Arndt8-Aug-16 23:46
professionalJochen Arndt8-Aug-16 23:46 
GeneralRe: const "getter" but updating on request? Pin
FriendOfAsherah9-Aug-16 2:30
FriendOfAsherah9-Aug-16 2:30 
GeneralRe: const "getter" but updating on request? Pin
Jochen Arndt9-Aug-16 3:03
professionalJochen Arndt9-Aug-16 3:03 
QuestionGrowing Pains Going from Debug to Release Pin
ForNow8-Aug-16 9:19
ForNow8-Aug-16 9:19 
AnswerRe: Growing Pains Going from Debug to Release Pin
CPallini8-Aug-16 20:31
mveCPallini8-Aug-16 20:31 
GeneralRe: Growing Pains Going from Debug to Release Pin
ForNow8-Aug-16 21:15
ForNow8-Aug-16 21:15 
QuestionC programming Pin
Kofi_Tommy7-Aug-16 8:16
Kofi_Tommy7-Aug-16 8:16 
QuestionRe: C programming Pin
David Crow7-Aug-16 10:38
David Crow7-Aug-16 10:38 
QuestionRe: C programming Pin
Paul Conrad13-Aug-16 18:09
professionalPaul Conrad13-Aug-16 18:09 
AnswerRe: C programming Pin
Kofi_Tommy17-Aug-16 10:04
Kofi_Tommy17-Aug-16 10:04 
QuestionMigrating old project to VS2008 - resource file errors Pin
charlieg4-Aug-16 3:10
charlieg4-Aug-16 3:10 

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.