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:
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.