--- In [email protected], "Sheri" <sheri...@...> wrote:
>
> I was able to implement some of what I wanted to do with out-of-process
> richedit using Undo(tomSuspend) and Undo(toReume) instead of nonfunctional
> BeginEditCollection and EndEditCollection. I think the reason we cannot most
> TOM methods is due to accessing an object instead of an interface.
I dunno. In general, if you have something that respons to QueryInterface at
all, it should work, and its methods and properties should work.
So for a few apps I've tried, this works:
local OBJID_WINDOW = 0x00000000
if (not visiblewindow("=wordpad")) do
do("wordpad.exe")
wait.for(visiblewindow("*Wordpad"))
endif
local hwnd = win.handle("=wordpad")
if (!hwnd)
quit
local hAO = com.get_accessible_object(hwnd, OBJID_WINDOW)
win.debug("Handle to an IAccessible: Wordpad OBJID_WINDOW:", hAO)
if (!hAO)
quit
win.debug("accName", hAO.accName(CHILDID_SELF))
win.debug("accChildCount", hAO.accChildCount())
which suggests to me that hAO is indeed a valid handle to a vlaid object.
But if one goes on:
hAO.release
local hAO = com.get_accessible_object(hwnd, OBJID_MENU)
win.debug("Handle to an IAccessible: Wordpad OBJID_MENU:", hAO)
if (!hAO)
quit
win.debug("accChildCount OBJID_MENU:", hAO.accChildCount())
;Menu Bar Object: Retrieves the IDispatch for the specified menu item.
;The child IDs for the menu items are numbered sequentially from left to right
starting with one.
;accDoDefaultAction
;For menu items from the menu bar, DoDefaultAction either displays or closes
the menu depending on the state of the menu.
;For menu items from a pop-up menu, DoDefaultAction clicks the menu item to
execute the menu command.
;fails
hAO.accDoDefaultAction(2) ;; exception
And in general, accDoDefaultActionretuens an exceptio from everywhere.
Don't get ot.