I can't wait to see what you come up with next. Any plans to take on context menus some time?
He already has, sort of.
I've already posted this in response to your question in a separate thread, but I wanted to cross-polinate in case some of the folks here wanted to know, too.
To get stuff from context menus, try this:
#include <A3LMenu.au3>;the source of much goodness.
;Can be found here:
;http://www.autoitscript.com/forum/index.php?showtopic=33677
Opt("WinTitleMatchMode", 4); Option required to be able to match window by classname
; Code to launch the context menu
; this can be arbitrarily complex, but don't forget that using
; ControlSend("<title", "", "<controlID>", "{APPSKEY}") can be just as effective
$hWnd = WinGetHandle("classname=#32768"); Part one of the magic - this is the classname for popups.
$hMenu = "0x" & Hex(_SendMessage($hWnd, $MF_GETHANDLE, 0, 0)); Part two of the magic
; where _SendMessage is found in Paul Campbell's Windows SDK
; library routines (A3LWinSDK.au3)
$text = _Menu_GetMenuString($hMenu, 0, $MF_BYPOSITION)
MsgBox(4096,"", "Menu item text: " & $text)
Also, to give proper credit to everybody, I would like to point out that the second part of the magic was lifted from Paul Campbell's _PopupScan() function (also in A3LWinSDK.au3), though I would not have known to steal it without Christian ASTOR's comment and Kuc's reply in this thread:
http://groups.google.com/group/microsoft.p...bf6f15e26a7d3a/
I would further like to point out that Mr. Campbell has some interesting code in A3LMenu.au3 that makes me wonder how difficult it will be to select items from submenus of context menus. However, since I don't have any applications right now that have that feature, I'll not worry about that until I get there.
I would finally like to point out that Mr. Campbell has also done some very interesting things with ToolbarWindow32 in case that's a sticking point for you as well.
To sum up . . .
- use Paul Williams AU3 libraries
- "classname=#32768" is the secret to getting the handle to the context menu window
- (_SendMessage($hWnd, $MF_GETHANDLE, 0, 0)) is the secret to getting the handle to the context menu
- hope this helps
- thank you again, Mr. Campbell!