views:

926

answers:

1

I have the handler of an open window which wasn't necessarily open by my process. How can I add a button to that window and make the button call a certain application (.exe) when clicked? The button could be next to the system menu or the minimize button. This should work for both XP and Vista (a different approach for each version is OK).

+1  A: 

The standard approach is to inject a DLL into the process with SetWindowsHookEx, hooking WH_CALLWNDPROC to monitor the WM_NCPAINT message. That used to work pretty well but no more. Visual Styles and Vista UAC will make you grow a pretty long beard. Common in the Windows 3.x days, I haven't seen this done in quite a while.

Hans Passant
Unfortunately, this doesn't give me the answer I've expected, but it's the best I've found until now. I don't even know how to phrase my question in Google... Considering the fact that answers such as "you can't do it" are valid ones, I have no choice but to accept yours. Thanks!
Tom