LMMS
Loading...
Searching...
No Matches
juce_win32_WinRTWrapper.h
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
27{
28public:
29 //==============================================================================
32
34
35 //==============================================================================
36 template <class ComClass>
37 ComSmartPtr<ComClass> activateInstance (const wchar_t* runtimeClassID, REFCLSID classUUID)
38 {
40
41 if (isInitialised())
42 {
43 ComSmartPtr<IInspectable> inspectable;
44 ScopedHString runtimeClass (runtimeClassID);
45 auto hr = roActivateInstance (runtimeClass.get(), inspectable.resetAndGetPointerAddress());
46
47 if (SUCCEEDED (hr))
48 inspectable->QueryInterface (classUUID, (void**) result.resetAndGetPointerAddress());
49 }
50
51 return result;
52 }
53
54 template <class ComClass>
55 ComSmartPtr<ComClass> getWRLFactory (const wchar_t* runtimeClassID)
56 {
58
59 if (isInitialised())
60 {
61 ScopedHString classID (runtimeClassID);
62
63 if (classID.get() != nullptr)
64 roGetActivationFactory (classID.get(), __uuidof (ComClass), (void**) comPtr.resetAndGetPointerAddress());
65 }
66
67 return comPtr;
68 }
69
70 //==============================================================================
72 {
73 public:
76
78
79 private:
80 HSTRING hstr = nullptr;
81
83 };
84
86
87private:
89
90 //==============================================================================
91 HMODULE winRTHandle = nullptr;
92 bool initialised = false;
93
100
107
108 //==============================================================================
110};
111
112} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_win32_ComSmartPtr.h:92
ComClass ** resetAndGetPointerAddress()
Definition juce_win32_ComSmartPtr.h:114
HRESULT QueryInterface(REFCLSID classUUID, ComSmartPtr< OtherComClass > &destObject) const
Definition juce_win32_ComSmartPtr.h:129
DeletedAtShutdown()
Definition juce_DeletedAtShutdown.cpp:34
Definition juce_String.h:53
Definition juce_win32_WinRTWrapper.h:72
HSTRING get() const noexcept
Definition juce_win32_WinRTWrapper.h:77
ScopedHString(String)
Definition juce_win32_WinRTWrapper.cpp:56
HSTRING hstr
Definition juce_win32_WinRTWrapper.h:80
Definition juce_win32_WinRTWrapper.h:27
HRESULT(WINAPI * RoActivateInstanceFuncPtr)(HSTRING, IInspectable **)
Definition juce_win32_WinRTWrapper.h:98
bool isInitialised() const noexcept
Definition juce_win32_WinRTWrapper.h:31
HMODULE winRTHandle
Definition juce_win32_WinRTWrapper.h:91
HRESULT(WINAPI * WindowsDeleteStringFuncPtr)(HSTRING)
Definition juce_win32_WinRTWrapper.h:96
String hStringToString(HSTRING)
Definition juce_win32_WinRTWrapper.cpp:70
ComSmartPtr< ComClass > getWRLFactory(const wchar_t *runtimeClassID)
Definition juce_win32_WinRTWrapper.h:55
PCWSTR(WINAPI * WindowsGetStringRawBufferFuncPtr)(HSTRING, UINT32 *)
Definition juce_win32_WinRTWrapper.h:97
WindowsDeleteStringFuncPtr deleteHString
Definition juce_win32_WinRTWrapper.h:103
RoActivateInstanceFuncPtr roActivateInstance
Definition juce_win32_WinRTWrapper.h:105
HRESULT(WINAPI * RoGetActivationFactoryFuncPtr)(HSTRING, REFIID, void **)
Definition juce_win32_WinRTWrapper.h:99
WinRTWrapper()
Definition juce_win32_WinRTWrapper.cpp:26
WindowsCreateStringFuncPtr createHString
Definition juce_win32_WinRTWrapper.h:102
RoGetActivationFactoryFuncPtr roGetActivationFactory
Definition juce_win32_WinRTWrapper.h:106
HRESULT(WINAPI * RoInitializeFuncPtr)(int)
Definition juce_win32_WinRTWrapper.h:94
HRESULT(WINAPI * WindowsCreateStringFuncPtr)(LPCWSTR, UINT32, HSTRING *)
Definition juce_win32_WinRTWrapper.h:95
bool initialised
Definition juce_win32_WinRTWrapper.h:92
WindowsGetStringRawBufferFuncPtr getHStringRawBuffer
Definition juce_win32_WinRTWrapper.h:104
RoInitializeFuncPtr roInitialize
Definition juce_win32_WinRTWrapper.h:101
ComSmartPtr< ComClass > activateInstance(const wchar_t *runtimeClassID, REFCLSID classUUID)
Definition juce_win32_WinRTWrapper.h:37
unsigned int UINT32
Definition fmopl.h:18
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
#define JUCE_DECLARE_SINGLETON(Classname, doNotRecreateAfterDeletion)
Definition juce_Singleton.h:184
#define __uuidof(x)
Definition juce_win32_ComSmartPtr.h:32
Definition carla_juce.cpp:31
HSTRING_PRIVATE * HSTRING
Definition juce_win32_Windowing.cpp:1269
Definition juce_win32_Windowing.cpp:1272
signed int HRESULT
Definition swell-types.h:181
#define WINAPI
Definition swell-types.h:631
int result
Definition process.c:1455
typedef int(UZ_EXP MsgFn)()
#define const
Definition zconf.h:137