--- In [email protected], "entropyreduction" 
<alancampbelllists+ya...@...> wrote:
>
> 
> 
> --- In [email protected], "Sheri" <sherip99@> 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.
>

I researched as best I could.

About 2/3rds into this article: 
<http://msdn.microsoft.com/en-us/library/cc301312.aspx>

It says:

"for each child, find the child ID and verify whether this child supports the 
IAccessible interface by getting a pointer to the IDispatch interface and 
querying it for an IAccessible interface."

I think to click a menu item you will need an accessible menu item, not a child 
of a menu bar. Menu bar does not do default actions. Menu items do.

Regards,
Sheri

Reply via email to