![]() |
Menu handler is 0 for Explorer folder main menu - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others) +--- Thread: Menu handler is 0 for Explorer folder main menu (/Thread-Menu-handler-is-0-for-Explorer-folder-main-menu) |
Menu handler is 0 for Explorer folder main menu - Andriana - 09-09-2009 Hi, Can anyone help me to find out why handler to the context menu is 0 for Windows Explorer folder’s main menu. Let’s say you open My Documents folder and it is necessary to get File->New->Folder item state (if it is enabled or disabled). Below is part of code from the book (p. 41) http://www.scribd.com/doc/6678471/Codes, which really works for WordPad, but when I try to do the same for Win Expl folder – FileMenuHandle is 0 Code: Extern.Declare micLong,"GetMenu", "user32.dll", "GetMenu",micHwnd RE: Menu handler is 0 for Explorer folder main menu - Saket - 09-10-2009 I guess it wont work until unless you click on the Menu of which submenu you want to get the handle. Try to click the menu and then get the submenu handle. let me know if it works. RE: Menu handler is 0 for Explorer folder main menu - Andriana - 09-10-2009 Thank you a lot for the idea, but it looks like it is not the cause of the problem: 1. If I run this part of code WordPad it retrieves all handlers successfully ' Get the Handle of the main window. Make sure you launch wordpad.exe before you run this example (insted of folder window) WinHandle = Window("title:=.* - WordPad", "index:=0").GetROProperty("hwnd") 2. I click on File menu (and still the problem is the same) Window("regexpwndtitle:="&strWin).WinToolbar("regexpwndclass:=ToolbarWindow32","windowstyle:=1442895949").Press "&File" My guess here is that the problem is because of objects hierarhy (our menu context is on the menu bar) and it seems that MenuHandle = Extern.GetMenu(WinHandle) is not the handler to the main menu. When I try to spy the menu the handler is not the same I get from the script ![]() What do you think about this? Will be really appreciate any thoughts. RE: Menu handler is 0 for Explorer folder main menu - Saket - 09-10-2009 Yes you are right Andriana, these menus are implemted as toolbarwin32 class. As this is not a standard menu, it can not be handled using GetMenu API. may be using WM_INITMENU will help. I will just check and get back. |