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. XP and Vista Caption bar problem with SetWindowRgn

XP and Vista Caption bar problem with SetWindowRgn

Scheduled Pinned Locked Moved C / C++ / MFC
comhelpquestion
3 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.
  • N Offline
    N Offline
    Nathan Going
    wrote on last edited by
    #1

    Im having a problem when I SetWindowRgn I lose the visual appearance of XP and Vista, as seen in Figure 1[^]. Any ideas of what I'm doing wrong? Here is the code i'm using DialogTest.rar Thanks

    M 1 Reply Last reply
    0
    • N Nathan Going

      Im having a problem when I SetWindowRgn I lose the visual appearance of XP and Vista, as seen in Figure 1[^]. Any ideas of what I'm doing wrong? Here is the code i'm using DialogTest.rar Thanks

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      Yes, that's what SetWindowRgn does. How can Windows know how to attach a title bar to your region? Applications that do this draw their own title bar and respond to WM_NCHITTEST to tell Windows which part of the UI has been hit. You can draw standard Windows controls with DrawThemeBackground/DrawThemeIcon/DrawThemeText etc, if theming is enabled, or DrawCaption/DrawFrameControl if not.

      DoEvents: Generating unexpected recursion since 1991

      N 1 Reply Last reply
      0
      • M Mike Dimmick

        Yes, that's what SetWindowRgn does. How can Windows know how to attach a title bar to your region? Applications that do this draw their own title bar and respond to WM_NCHITTEST to tell Windows which part of the UI has been hit. You can draw standard Windows controls with DrawThemeBackground/DrawThemeIcon/DrawThemeText etc, if theming is enabled, or DrawCaption/DrawFrameControl if not.

        DoEvents: Generating unexpected recursion since 1991

        N Offline
        N Offline
        Nathan Going
        wrote on last edited by
        #3

        No, I understand that. I’m setting the region when the user presses the button, then unsetting the region when it's pressed again. The problem is that when I put back WS_CAPTION the window was being redrawn without visual styles. I just figured out that I was clearing the region after setting WS_CAPTION back to my window. I switched the order and every thing worked perfectly.... Thanks for your response.

        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