Problem handling WM_NCPAINT using XP visual style
-
Hi! I wrote an application where I draw an additional button to the caption of a dialog. This works perfectly for all versions of windows, even for XP when the "classic style" is used. But, if I select an XP theme, I run into a problem: When I handle the WM_NCPAINT message, the caption of the dialog (and also the frame) is not drawn using the corresponding visual style, it is drawn in "classic style"! This looks really ugly. My SDK is up to date. I tried it with and without a manifest file, it makes no difference. I develop the code under win2k, using vc6. Maybe this is the problem: does anybody know, if this works correctly with vc7? If anybody has an idea how to solve this problem, please help. I've been trying it for two weeks now any I'm out of ideas... X| Thanks in advance, Marcus.
-
Hi! I wrote an application where I draw an additional button to the caption of a dialog. This works perfectly for all versions of windows, even for XP when the "classic style" is used. But, if I select an XP theme, I run into a problem: When I handle the WM_NCPAINT message, the caption of the dialog (and also the frame) is not drawn using the corresponding visual style, it is drawn in "classic style"! This looks really ugly. My SDK is up to date. I tried it with and without a manifest file, it makes no difference. I develop the code under win2k, using vc6. Maybe this is the problem: does anybody know, if this works correctly with vc7? If anybody has an idea how to solve this problem, please help. I've been trying it for two weeks now any I'm out of ideas... X| Thanks in advance, Marcus.
AFAICT this is By Design(tm). Since themes change the look of the non-client area, when an app handles WM_NCPAINT (also to change the look of the non-client area), XP turns off the theme so the app's own painting takes precedence. Look at RealPlayer 8 for another example. --Mike-- "Big handwavy generalizations made from a position of deep ignorance is one of the biggest wastes of time on the net today. -- Joel Spolsky Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
-
AFAICT this is By Design(tm). Since themes change the look of the non-client area, when an app handles WM_NCPAINT (also to change the look of the non-client area), XP turns off the theme so the app's own painting takes precedence. Look at RealPlayer 8 for another example. --Mike-- "Big handwavy generalizations made from a position of deep ignorance is one of the biggest wastes of time on the net today. -- Joel Spolsky Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Thank you for the answer, Mike. Is it possible, to draw the nonclient area by hand using the correct theme? I know that I can use GetSystemMetrics() to get all dimensions I need. I also know that I can load the theme elements from the uxtheme.dll. But, I'm not sure how to apply them to the window. Do you know how to do that? Any code fragments, links to descriptions or articles would help, too. Thanks again, Marcus.