This example checks to see if the menu has the focus.
#define INCL_WININPUT #include <OS2.H> #define SYS_MENU 900 HWND hwndFrame; if (WinQueryFocus(HWND_DESKTOP) == WinWindowFromID(hwndFrame, SYS_MENU)) { /* . */ }