
September 11th, 2003, 03:06 AM
|
|
Dude' Where's My JD and Coke
|
|
Join Date: Sep 2003
Location: Newbury, England
Posts: 37

Time spent in forums: < 1 sec
Reputation Power: 5
|
|
|
Accessibility API's
I have asked this question all over the place and have not got any response, so this is my last hope.
I am using the API AccessibleObjectFromWindow( ... ) to find the menu bar of an office application. I am using this function in conjunction with the OBJID_NATIVEOM param to get the native object model of the commandbar. The function works and returns S_OK. The problem is that the object returned is an IAccessible* I use query interface to see the object supports the command bar interface and low and behold it doesn't. By examining the object returned I can see that it is the command bar because it has all of the properties. i.e. Name, Role, even position.
If anyone knows how to get this to work I would be very grateful if you could explain how. Any suggestion, tips or comments would be appreciated.
Just for reference here is a very very cut down version of the code. It is hosted in a C++ Com DLL that is being called by a VB.Net Client (I know VB.Net isn't the best choice of client, but they are making me use it because they "can’t afford to re-train staff to uses C++")
STDMETHODIMP CUtils::GetMenu(IDispatch** ppMenu)
{
IDispatch * pDisp = NULL;
HWND hWnd = FindWindowEx(GetDesktopWindow(), NULL, "wndclass_desked_gsk",NULL);
hWnd = FindWindowEx(hWnd, NULL, "MsoCommandBarDock", "MsoDockTop");
hWnd = FindWindowEx(hWnd, NULL, "MsoCommandBar", "MenuBar");
AccessibleObjectFromWindow(hWnd, OBJID_NATIVEOM, IID_IDispatch, (void**) ppMenu);
return S_OK;
}
|