09-09-2009, 11:44 PM
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
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
Extern.Declare micLong, "GetSubMenu", "user32.dll", "GetSubMenu", micLong, micInteger
‘// My Documents should be opened
strWin = "My Documents"
Window("regexpwndtitle:="&strWin).Activate
wait 1
' Get the Handle of the window.
WinHandle = Window("regexpwndtitle:="&strWin).GetROProperty("hwnd")
' Window("regexpwndtitle:="&strWin).WinToolbar("regexpwndclass:=ToolbarWindow32","windowstyle:=1442895949") ‘// menu bar where actually main menu is located
' Get Handle Of Main Menu ( e.g File, Edit, View. etc )
MenuHandle = Extern.GetMenu ( WinHandle )
' Get Handle Of "File" Menu ( 0= File, 1=Edit, 2=View etc )
FileMenuHandle = Extern.GetSubMenu ( MenuHandle, 0 ) ‘// And here I get “0”