I'm trying to figure out how to draw a custom button on the caption bar of windows when using the Aero theme in Vista or Win7. I need to apply this to a number of different applications without changing the original code, so this will be in a hook procedure. Since I can't change the original code, I can't use DwmExtendFrameIntoClientArea.
I'm pretty sure this can be done, or at least faked really well, because I've seen an app that can do this. I've taken a pretty close look at various windows while this other app is running, and I don't believe they're altering the window style or extending the frame into the client area.
As a test, I tried to use the WM_NCPAINT message to paint something onto the caption bar. When the Aero theme is active, nothing I paint will appear. If I get a DC for the entire screen instead of just the window, then I can "paint" onto the caption bar, but of course, it's really being painted to the screen. There are all kinds of problems with that approach, so that doesn't work. If anyone has any good ideas, or even good hints, I'd really appreciate the help!