How can I paint an image in the caption bar?

  • Thread starter Thread starter simon22
  • Start date Start date
S

simon22

Guest
Hi - I want to paint a small image in the caption bar of various windows, just to the left of the Close button on the right-hand side (these are all floating modeless dialogs in fact) in my (Visual C++ 2017, MFC) application. I originally thought I'd just need to add a small paint in a handler for WM_NCPAINT. That did not work - not on my PC, running Windows 10. All paints have zero effect. I then learned that since Vista and Aero, painting in the caption bar has got much more complicated. It appears that I probably have to do something clever with the Desktop Window Manager (DWM) API. I found this page: Custom Window Frame Using DWM - Windows applications (Custom Window Frame Using DWM), but was unable to follow the instructions (I couldn't work out what I was supposed to put in the handler for WM_NCCALCSIZE for example). I also found an article called "Setting up a custom title bar on Vista/Windows 7" (Setting up a custom title bar on Vista/Windows 7). The code in that case is Delphi. I tried to work out how to do what they do in C++, but failed there too.

Has anybody done this? Added an image or an icon to the caption bar? If so, could you give me some pointers? Or best of all a working sample?

Many thanks

Simon




Simon

Continue reading...
 
Back
Top