Question: I need to enumerate all running applications. In particular, all top windows. And for every window I need to add my custom item to the system menu of that window.

How can I accomplish that in C++?

**Update.**

I would be more than happy to have a solution for Windows, MacOS, and Ubuntu (though, I'm not sure if MacOS and Ubuntu have such thing as 'system menu').

Answer: 
Once you have another window's top level handle, you may be able to call [GetMenu()](http://msdn.microsoft.com/en-us/library/ms647640(VS.85).aspx) to retrieve the Window's system menu and then modify it, eg:

```
HMENU hMenu = GetMenu(hwndNext);

```
You can use [EnumWindows()](http://msdn.microsoft.com/en-us/library/ms633497(VS.85).aspx) to enumerate top level Windows.

I don't have a specific answer for the second part of your question, but if you subclass the window, I imagine you can modify the system menu.

EDIT: or do what Chris said: call GetMenu()