|
-
February 11th, 2003, 11:42 AM
#1
Communication with another Window in the desktop
Hi,
I am trying to access the menu items of another window in the desktop. This particular window has no menu assigned to it.
Instead the menu bar of this window exists as a window itself, descended from the parent window. I have observed that the same structure exists for Microsoft Visual Studio and Microsoft Word.
But, for windows like Notepad, there is a menu bar assigned to the parent window. Because of this, the following code helps me to access the menu items of Notepad window:
HWND noteHwnd = ::FindWindow(NULL,_T("Untitled - Notepad"));
HMENU hMainMenu = ::GetMenu(noteHwnd);
HMENU hSubMenu = ::GetSubMenu(hMainMenu,0);
UINT menuId = ::GetMenuItemID(hSubMenu,1);
::SendMessage(noteHwnd,WM_COMMAND,menuId,0);
But, the same procedure if applied to Microsft Visual Studio etc, gives me NULL as the Menu handle. As my required window is similar to Visual Studio, it faces the same problem.
Can anyone tell me how should I go about to get the menu handle for such class of windows, so that I can access the menu items in such windows?
Thankyou,
Dalys
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|