tags:

views:

133

answers:

3

I'd like to write a utility in the vein of PowerMenu - it adds some extra stuff into all applications' window menus (alt-space, that menu).

How does one go about doing this?

A: 

It's a classic code posted ~14 years ago on google (groups)
See Win32 grp for official method (MS, with hooks)

+1  A: 
  1. Inject some code to each window's process.
  2. Use GetSystemMenu() in the hook to retrieve that windows "alt-space" menu
  3. Make your modifications
  4. Cleanup

I'd personally use SetWindowsHookEx(), WH_CALLWNDPROC, and a CallWndProc to achieve step 1, requiring a call to UnhookWindowsHookEx() in step 4, and bit of custom message pumping to get step 2 rolling. That's just personal preference though.

Kevin Montrose