[PATCH v3 6/8] oleacc: Add get_accValue function for edit client accessible object.
Connor McAdams
cmcadams at codeweavers.com
Fri Sep 24 11:45:14 CDT 2021
Signed-off-by: Connor McAdams <cmcadams at codeweavers.com>
---
dlls/oleacc/client.c | 34 ++++++++++++++++++++++++++++++----
1 file changed, 30 insertions(+), 4 deletions(-)
diff --git a/dlls/oleacc/client.c b/dlls/oleacc/client.c
index ed7dd86b13b..636e7a1cfea 100644
--- a/dlls/oleacc/client.c
+++ b/dlls/oleacc/client.c
@@ -47,6 +47,7 @@ struct win_class_vtbl {
HRESULT (*get_state)(Client*, VARIANT, VARIANT*);
HRESULT (*get_name)(Client*, VARIANT, BSTR*);
HRESULT (*get_kbd_shortcut)(Client*, VARIANT, BSTR*);
+ HRESULT (*get_value)(Client*, VARIANT, BSTR*);
};
static HRESULT acc_client_get_name_str(WCHAR *name, UINT len, BSTR *name_out)
@@ -226,14 +227,17 @@ static HRESULT WINAPI Client_get_accName(IAccessible *iface, VARIANT id, BSTR *n
return acc_client_get_name_str(name, len, name_out);
}
-static HRESULT WINAPI Client_get_accValue(IAccessible *iface, VARIANT varID, BSTR *pszValue)
+static HRESULT WINAPI Client_get_accValue(IAccessible *iface, VARIANT id, BSTR *value_out)
{
Client *This = impl_from_Client(iface);
- TRACE("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszValue);
+ TRACE("(%p)->(%s %p)\n", This, debugstr_variant(&id), value_out);
- *pszValue = NULL;
- if(convert_child_id(&varID) != CHILDID_SELF)
+ *value_out = NULL;
+ if (This->vtbl && This->vtbl->get_value)
+ return This->vtbl->get_value(This, id, value_out);
+
+ if(convert_child_id(&id) != CHILDID_SELF)
return E_INVALIDARG;
return S_FALSE;
}
@@ -777,11 +781,33 @@ static HRESULT edit_get_kbd_shortcut(Client *client, VARIANT id, BSTR *kbd_short
return acc_client_get_kbd_shortcut_str(name, len, kbd_shortcut_out);
}
+static HRESULT edit_get_value(Client *client, VARIANT id, BSTR *value_out)
+{
+ WCHAR *buf;
+ UINT len;
+
+ if (convert_child_id(&id) != CHILDID_SELF) return E_INVALIDARG;
+
+ if (GetWindowLongW(client->hwnd, GWL_STYLE) & ES_PASSWORD)
+ return E_ACCESSDENIED;
+
+ len = SendMessageW(client->hwnd, WM_GETTEXTLENGTH, 0, 0);
+ buf = heap_alloc_zero((len + 1) * sizeof(*buf));
+ if (!buf) return E_OUTOFMEMORY;
+
+ SendMessageW(client->hwnd, WM_GETTEXT, len + 1, (LPARAM)buf);
+ *value_out = SysAllocString(buf);
+ heap_free(buf);
+
+ return S_OK;
+}
+
static const win_class_vtbl edit_vtbl = {
edit_init,
edit_get_state,
edit_get_name,
edit_get_kbd_shortcut,
+ edit_get_value,
};
static const struct win_class_data classes[] = {
--
2.25.1
More information about the wine-devel
mailing list