Drawing caption in dialog, who can help me?
-
I'm trying to draw the caption (title bar) of a dialog myself, but I'm stuck. I can draw to the non-client area, but I cannot prevent the painting of the ordinary caption bar. I tried something with the WM_NCPAINT and WM_NCACTIVATE messages, but WM_NCPAINT seems only to have to do with the actual border, and WM_NCACTIVATE doesn't seem to have anything to do with painting at all... Can somebody please tell me what I'm doing wrong? Cheers
-
I'm trying to draw the caption (title bar) of a dialog myself, but I'm stuck. I can draw to the non-client area, but I cannot prevent the painting of the ordinary caption bar. I tried something with the WM_NCPAINT and WM_NCACTIVATE messages, but WM_NCPAINT seems only to have to do with the actual border, and WM_NCACTIVATE doesn't seem to have anything to do with painting at all... Can somebody please tell me what I'm doing wrong? Cheers
If you were in a regular window then you would return false in your handler for WM_NCACTIVATE and do not call the defWindowProc windows will not paint the caption for you. Since you are in a dialog, you will still need to return true to indicate that you handled the message, but you will need to call
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE);
. This will set the return result of you message to false, and tell windows not to draw the caption. Then you will be responsible for it. -
If you were in a regular window then you would return false in your handler for WM_NCACTIVATE and do not call the defWindowProc windows will not paint the caption for you. Since you are in a dialog, you will still need to return true to indicate that you handled the message, but you will need to call
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE);
. This will set the return result of you message to false, and tell windows not to draw the caption. Then you will be responsible for it.Thanks for your reply but I still can't get it to work... When I boot the app no borders or caption are drawn. But when I click the caption, windows paints the system menu and a horizontal line that seperates the client and the non-client area. I couldn't find any messages that could be responsible for this with Spy++. When NCPAINT messages are send I can override them, but this is quite confusing. Also, I'm not quite sure where to put the SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); you mentioned. Please help me out
-
Thanks for your reply but I still can't get it to work... When I boot the app no borders or caption are drawn. But when I click the caption, windows paints the system menu and a horizontal line that seperates the client and the non-client area. I couldn't find any messages that could be responsible for this with Spy++. When NCPAINT messages are send I can override them, but this is quite confusing. Also, I'm not quite sure where to put the SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); you mentioned. Please help me out
Griffith Sutherns wrote: Also, I'm not quite sure where to put the SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); you mentioned This goes in your WM_NCACTIVATE message handler. Inside of your DLGProc, and dialog proc cannot return the result of the message the same way a window proc does, therefore you need to call set window long and set the result there instead.