[PATCH v3] oleacc: Add support for retrieving an HWND from accNavigate to WindowFromAccessibleObject.

Piotr Caban piotr.caban at gmail.com
Mon May 16 09:17:10 CDT 2022


Hi Connor,

On 5/13/22 18:43, Connor McAdams wrote:
> @@ -155,7 +167,12 @@ static HRESULT WINAPI Accessible_get_accParent(
>           IAccessible *iface, IDispatch **ppdispParent)
>   {
>       if(iface == &Accessible_child)
> +    {
>           CHECK_EXPECT(Accessible_child_get_accParent);
> +        if (OleWindow_hwnd) > +            return IAccessible_QueryInterface(&Accessible, 
&IID_IDispatch,
> +                    (void **)ppdispParent);
I don't understand this part. Why do you need to check OleWindow_hwnd? 
It would probably make sense to return parent unconditionally.

> +#define NAVDIR_INTERNAL_HWND 10
>   static HRESULT WINAPI Accessible_accNavigate(IAccessible *iface,
>           LONG navDir, VARIANT varStart, VARIANT *pvarEnd)
>   {
> -    ok(0, "unexpected call\n");
> +    if(iface == &Accessible_child)
> +        CHECK_EXPECT(Accessible_child_accNavigate);
> +    else
> +        CHECK_EXPECT(Accessible_accNavigate);
> +
> +    /*
> +     * Magic number value for retrieving an HWND. Used by DynamicAnnotation
> +     * IAccessible wrapper.
> +     */
> +    if(navDir == NAVDIR_INTERNAL_HWND) {
> +        V_VT(pvarEnd) = VT_I4;
> +        V_I4(pvarEnd) = HandleToULong(Accessible_accnav_hwnd);
> +        return S_OK;
S_FALSE or E_INVALIDARG looks like a better return value when 
Accessible_accnav_hwnd is NULL (unless there's value in testing S_OK). 
How about changing Accessible_accnav_hwnd name to Accessible_hwnd?

> +static HRESULT WINAPI OleWindow_GetWindow(IOleWindow *iface, HWND *hwnd)
> +{
> +    *hwnd = OleWindow_hwnd;
> +    return S_OK;
Again, I don't know if there's value in testing NULL HWND and S_OK 
return. If not, documentation suggests returning E_FAIL.

Thanks,
Piotr



More information about the wine-devel mailing list