4#include <QtGui/qtguiglobal.h>
5#if QT_CONFIG(accessibility)
7#include "qwindowsuiautomation.h"
11template<
typename T,
typename... TArg>
14 using func_t = T(WINAPI*)(TArg...);
18# pragma GCC diagnostic push
19# pragma GCC diagnostic ignored "-Wcast-function-type"
21 winapi_func(
const char *lib_name,
const char *func_name, func_t func_proto,
22 T error_value = T(__HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND))) :
23 func(
reinterpret_cast<func_t>(GetProcAddress(LoadLibraryA(lib_name), func_name))),
24 error_value(error_value)
26 std::ignore = func_proto;
29# pragma GCC diagnostic pop
41BOOL WINAPI UiaClientsAreListening()
43 static auto func = winapi_func(
"uiautomationcore", FN(UiaClientsAreListening), BOOL(
false));
47LRESULT WINAPI UiaReturnRawElementProvider(
48 HWND hwnd, WPARAM wParam, LPARAM lParam, IRawElementProviderSimple *el)
50 static auto func = winapi_func(
"uiautomationcore", FN(UiaReturnRawElementProvider));
51 return func.invoke(hwnd, wParam, lParam, el);
54HRESULT WINAPI UiaHostProviderFromHwnd(HWND hwnd, IRawElementProviderSimple **ppProvider)
56 static auto func = winapi_func(
"uiautomationcore", FN(UiaHostProviderFromHwnd));
57 return func.invoke(hwnd, ppProvider);
60HRESULT WINAPI UiaRaiseAutomationPropertyChangedEvent(
61 IRawElementProviderSimple *pProvider, PROPERTYID id, VARIANT oldValue, VARIANT newValue)
63 static auto func = winapi_func(
"uiautomationcore", FN(UiaRaiseAutomationPropertyChangedEvent));
64 return func.invoke(pProvider, id, oldValue, newValue);
67HRESULT WINAPI UiaRaiseAutomationEvent(IRawElementProviderSimple *pProvider, EVENTID id)
69 static auto func = winapi_func(
"uiautomationcore", FN(UiaRaiseAutomationEvent));
70 return func.invoke(pProvider, id);
73HRESULT WINAPI UiaRaiseNotificationEvent(
74 IRawElementProviderSimple *pProvider, NotificationKind notificationKind,
75 NotificationProcessing notificationProcessing, BSTR displayString, BSTR activityId)
77 static auto func = winapi_func(
"uiautomationcore", FN(UiaRaiseNotificationEvent));
78 return func.invoke(pProvider, notificationKind, notificationProcessing, displayString, activityId);