5#include <QtGui/qtguiglobal.h>
6#if QT_CONFIG(accessibility)
8#include "qwindowsuiautomation.h"
12template<
typename T,
typename... TArg>
15 using func_t = T(WINAPI*)(TArg...);
19# pragma GCC diagnostic push
20# pragma GCC diagnostic ignored "-Wcast-function-type"
22 winapi_func(
const char *lib_name,
const char *func_name, func_t func_proto,
23 T error_value = T(__HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND))) :
24 func(
reinterpret_cast<func_t>(GetProcAddress(LoadLibraryA(lib_name), func_name))),
25 error_value(error_value)
27 std::ignore = func_proto;
30# pragma GCC diagnostic pop
42BOOL WINAPI UiaClientsAreListening()
44 static auto func = winapi_func(
"uiautomationcore", FN(UiaClientsAreListening), BOOL(
false));
48LRESULT WINAPI UiaReturnRawElementProvider(
49 HWND hwnd, WPARAM wParam, LPARAM lParam, IRawElementProviderSimple *el)
51 static auto func = winapi_func(
"uiautomationcore", FN(UiaReturnRawElementProvider));
52 return func.invoke(hwnd, wParam, lParam, el);
55HRESULT WINAPI UiaHostProviderFromHwnd(HWND hwnd, IRawElementProviderSimple **ppProvider)
57 static auto func = winapi_func(
"uiautomationcore", FN(UiaHostProviderFromHwnd));
58 return func.invoke(hwnd, ppProvider);
61HRESULT WINAPI UiaRaiseAutomationPropertyChangedEvent(
62 IRawElementProviderSimple *pProvider, PROPERTYID id, VARIANT oldValue, VARIANT newValue)
64 static auto func = winapi_func(
"uiautomationcore", FN(UiaRaiseAutomationPropertyChangedEvent));
65 return func.invoke(pProvider, id, oldValue, newValue);
68HRESULT WINAPI UiaRaiseAutomationEvent(IRawElementProviderSimple *pProvider, EVENTID id)
70 static auto func = winapi_func(
"uiautomationcore", FN(UiaRaiseAutomationEvent));
71 return func.invoke(pProvider, id);
74HRESULT WINAPI UiaRaiseNotificationEvent(
75 IRawElementProviderSimple *pProvider, NotificationKind notificationKind,
76 NotificationProcessing notificationProcessing, BSTR displayString, BSTR activityId)
78 static auto func = winapi_func(
"uiautomationcore", FN(UiaRaiseNotificationEvent));
79 return func.invoke(pProvider, notificationKind, notificationProcessing, displayString, activityId);