42 #include <QtCore/qdebug.h>
43 #include <winstring.h>
46 #if defined(Q_CC_MINGW) || defined(Q_CC_CLANG)
47 # define HAS_UI_VIEW_SETTINGS_INTEROP
49 #elif (!defined(Q_CC_MSVC) || _MSC_VER >= 1900) && WINVER >= 0x0A00
50 # define HAS_UI_VIEW_SETTINGS_INTEROP
51 # define HAS_UI_VIEW_SETTINGS
54 #include <inspectable.h>
56 #ifdef HAS_UI_VIEW_SETTINGS
57 # include <windows.ui.viewmanagement.h>
60 #ifdef HAS_UI_VIEW_SETTINGS_INTEROP
61 # include <uiviewsettingsinterop.h>
64 #ifndef HAS_UI_VIEW_SETTINGS_INTEROP
65 MIDL_INTERFACE(
"3694dbf9-8f68-44be-8ff5-195c98ede8a6")
66 IUIViewSettingsInterop : public IInspectable
69 virtual HRESULT STDMETHODCALLTYPE GetForWindow(
72 __RPC__deref_out_opt
void **
ppv) = 0;
76 #ifndef HAS_UI_VIEW_SETTINGS
80 namespace ViewManagement {
84 MIDL_INTERFACE(
"C63657F6-8850-470D-88F8-455E16EA2C26")
85 IUIViewSettings : public IInspectable
104 const wchar_t uiViewSettingsId[] =
L"Windows.UI.ViewManagement.UIViewSettings";
105 HSTRING_HEADER uiViewSettingsIdRefHeader;
106 HSTRING uiViewSettingsIdHs =
nullptr;
107 const auto uiViewSettingsIdLen =
UINT32(
sizeof(uiViewSettingsId) /
sizeof(uiViewSettingsId[0]) - 1);
108 if (FAILED(WindowsCreateStringReference(uiViewSettingsId, uiViewSettingsIdLen, &uiViewSettingsIdRefHeader, &uiViewSettingsIdHs)))
111 IUIViewSettingsInterop *uiViewSettingsInterop =
nullptr;
113 const GUID uiViewSettingsInteropRefId = {0x3694dbf9, 0x8f68, 0x44be,{0x8f, 0xf5, 0x19, 0x5c, 0x98, 0xed, 0xe8, 0xa6}};
115 HRESULT hr = RoGetActivationFactory(uiViewSettingsIdHs, uiViewSettingsInteropRefId,
116 reinterpret_cast<void **
>(&uiViewSettingsInterop));
121 const GUID uiViewSettingsRefId = {0xc63657f6, 0x8850, 0x470d,{0x88, 0xf8, 0x45, 0x5e, 0x16, 0xea, 0x2c, 0x26}};
122 ABI::Windows::UI::ViewManagement::IUIViewSettings *viewSettings =
nullptr;
123 hr = uiViewSettingsInterop->GetForWindow(hwnd, uiViewSettingsRefId,
124 reinterpret_cast<void **
>(&viewSettings));
127 hr = viewSettings->get_UserInteractionMode(¤tMode);
129 result = currentMode == 1;
130 viewSettings->Release();
132 uiViewSettingsInterop->Release();
EGLOutputLayerEXT EGLint EGLAttrib value
IUIViewSettingsInterop __RPC__in REFIID riid
IUIViewSettingsInterop __RPC__in REFIID __RPC__deref_out_opt void ** ppv
QT_BEGIN_NAMESPACE bool qt_windowsIsTabletMode(HWND hwnd)