Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Drawing caption in dialog, who can help me?

Drawing caption in dialog, who can help me?

Scheduled Pinned Locked Moved C / C++ / MFC
helpgraphicsquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    generic_user_id
    wrote on last edited by
    #1

    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

    P 1 Reply Last reply
    0
    • G generic_user_id

      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

      P Offline
      P Offline
      Paul M Watt
      wrote on last edited by
      #2

      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.

      G 1 Reply Last reply
      0
      • P Paul M Watt

        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.

        G Offline
        G Offline
        generic_user_id
        wrote on last edited by
        #3

        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

        P 1 Reply Last reply
        0
        • G generic_user_id

          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

          P Offline
          P Offline
          Paul M Watt
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups