#1
  1. No Profile Picture
    Dude' Where's My JD and Coke
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Newbury, England
    Posts
    37
    Rep Power
    12

    Unhappy Last Hope! C++ and the API from HELL!


    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;
    }
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Location
    NC, USA
    Posts
    364
    Rep Power
    13
    I know absolutely nothing about the Win32 API but the folks HERE can probably help you.
  4. #3
  5. No Profile Picture
    Dude' Where's My JD and Coke
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Newbury, England
    Posts
    37
    Rep Power
    12
    Thanks

IMN logo majestic logo threadwatch logo seochat tools logo