Thread: A menu issue -
View Single Post
Old Jan 26th, 2008, 2:35 PM   #1
pcbrainbuster
Programmer
 
Join Date: Dec 2007
Posts: 93
Rep Power: 1 pcbrainbuster is on a distinguished road
Exclamation A menu issue -

Sup guys,

A part of my menu is supposed to capture all open windows and list them, the problem is; since the number of windows could be random I have no way of knowing what's open so I need to know what the user clicked on, I prepared this piece of code to do that -

C++ Syntax (Toggle Plain Text)
  1. [WM_COMMAND]
  2. ...
  3. default :
  4. {
  5.  
  6. POINT CurMPos;
  7. int SelMI;
  8. char MenuString[255];
  9.  
  10. GetCursorPos(&CurMPos);
  11.  
  12. SelMI = MenuItemFromPoint(hWnd, WindowList, CurMPos);
  13.  
  14. GetMenuString(WindowList, SelMI, MenuString, 255, MF_BYPOSITION);
  15. MessageBox(NULL, MenuString, "Selected Window", MB_OK);
  16.  
  17. }
  18. ...

Sadly enough though my program does not retrieve the title... Do you guys know what went wrong or of any easier way?

Thanks.

Last edited by Ancient Dragon; Jan 26th, 2008 at 5:52 PM. Reason: corrected code tags -- do not put any spaces in them
pcbrainbuster is offline   Reply With Quote