Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwindowsuiautomation.cpp
Go to the documentation of this file.
1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include <QtGui/qtguiglobal.h>
5#if QT_CONFIG(accessibility)
6
8
9#if defined(__MINGW32__) || defined(__MINGW64__)
10
11template<typename T, typename... TArg>
12struct winapi_func
13{
14 using func_t = T(WINAPI*)(TArg...);
15 const func_t func;
16 const T error_value;
17#ifdef __GNUC__
18# pragma GCC diagnostic ignored "-Wcast-function-type"
19#endif
20 winapi_func(const char *lib_name, const char *func_name, func_t func_proto,
21 T error_value = T(__HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND))) :
22 func(reinterpret_cast<func_t>(GetProcAddress(LoadLibraryA(lib_name), func_name))),
23 error_value(error_value)
24 {
25 std::ignore = func_proto;
26 }
27#ifdef __GNUC__
28# pragma GCC diagnostic pop
29#endif
30 T invoke(TArg... arg)
31 {
32 if (!func)
33 return error_value;
34 return func(arg...);
35 }
36};
37
38#define FN(fn) #fn,fn
39
40BOOL WINAPI UiaClientsAreListening()
41{
42 static auto func = winapi_func("uiautomationcore", FN(UiaClientsAreListening), BOOL(false));
43 return func.invoke();
44}
45
46LRESULT WINAPI UiaReturnRawElementProvider(
47 HWND hwnd, WPARAM wParam, LPARAM lParam, IRawElementProviderSimple *el)
48{
49 static auto func = winapi_func("uiautomationcore", FN(UiaReturnRawElementProvider));
50 return func.invoke(hwnd, wParam, lParam, el);
51}
52
53HRESULT WINAPI UiaHostProviderFromHwnd(HWND hwnd, IRawElementProviderSimple **ppProvider)
54{
55 static auto func = winapi_func("uiautomationcore", FN(UiaHostProviderFromHwnd));
56 return func.invoke(hwnd, ppProvider);
57}
58
59HRESULT WINAPI UiaRaiseAutomationPropertyChangedEvent(
60 IRawElementProviderSimple *pProvider, PROPERTYID id, VARIANT oldValue, VARIANT newValue)
61{
62 static auto func = winapi_func("uiautomationcore", FN(UiaRaiseAutomationPropertyChangedEvent));
63 return func.invoke(pProvider, id, oldValue, newValue);
64}
65
66HRESULT WINAPI UiaRaiseAutomationEvent(IRawElementProviderSimple *pProvider, EVENTID id)
67{
68 static auto func = winapi_func("uiautomationcore", FN(UiaRaiseAutomationEvent));
69 return func.invoke(pProvider, id);
70}
71
72HRESULT WINAPI UiaRaiseNotificationEvent(
73 IRawElementProviderSimple *pProvider, NotificationKind notificationKind,
74 NotificationProcessing notificationProcessing, BSTR displayString, BSTR activityId)
75{
76 static auto func = winapi_func("uiautomationcore", FN(UiaRaiseNotificationEvent));
77 return func.invoke(pProvider, notificationKind, notificationProcessing, displayString, activityId);
78}
79
80#endif // defined(__MINGW32__) || defined(__MINGW64__)
81
82#endif // QT_CONFIG(accessibility)
GLenum func
Definition qopenglext.h:663
SSL_CTX int void * arg
long HRESULT
QStringView el