gzcjun

I want to get hwnd of IE main menu,and click one of the items,for example:View->Refresh,I write codes like this:
HWND hwndIE=::FindWindow(_T("IEFrame"),NULL);
HMENU appMenu=::GetMenu(hwndIE);
HMENU subMenu=::GetSubMenu(appMenu,1);
...
Everytime I got zero from subMenu,why


Re: Internet Explorer Extension Development How to get IE main menu hwnd?

rtpninja

:-)





Re: Internet Explorer Extension Development How to get IE main menu hwnd?

gzcjun

Thank you for your help,I originally wanted to do like what you say,my opinion is:at first,find the hwnd of the main menu,and then find the 3rd one (for example:View),then get all of the items contained in it,find the word I want(for example:Refresh),at last I simulate to click it(use sendmessage),the code like this:
************************************************************************************************
HWND hwndIE,hwndWorker,hwndReBar,hwndToolBar;
hwndIE=::FindWindow(_T("IEFrame"),NULL);
hwndWorker=::FindWindowEx(hwndIE,NULL,_T("WorkerW"),NULL);
hwndReBar=::FindWindowEx(hwndWorker,NULL,_T("ReBarWindow32"),NULL);
hwndToolBar=::FindWindowEx(hwndReBar,NULL,_T("ToolbarWindow32"),NULL);
HMENU AppMenu=::GetMenu(hwndToolBar);
int iMenuCount=::GetMenuItemCount(AppMenu)-1;
LPTSTR lpString;
for (int i=0;i<iMenuCount;i++)
{
if (::GetMenuString(AppMenu,i,lpString,128,MF_BYPOSITION)!=0)
{
lID=::GetMenuItemID(AppMenu,i);

}
}
//using SendMessage to simulate clicking the item I want.
**************************************************************************************************

My destination is to get the hwnd of the menu,find the item I want,and then simulate to click the item.How can I do then




Re: Internet Explorer Extension Development How to get IE main menu hwnd?

gzcjun

I also heard someone said it's impossible to get the menu hwnd by using getmenu because IE use the control.If it's true,how can I solve the problem




Re: Internet Explorer Extension Development How to get IE main menu hwnd?

IECUSTOMIZER

Hi,

Its not a windows menu, its a toolbar button, type menu. You will have to manipulate the menu toolbar's button collection.

Regards.






Re: Internet Explorer Extension Development How to get IE main menu hwnd?

coxxxtel

Still how could View->Refresh be clicked
I've attached a hook to the IE process, I've managed to call TB_GETBUTTON and get information about File, Edit, View.

But I do not know how to get the HMENU for the popup menus from dwData of TBBUTTON.

Can you help