Skip to content

Commit 5aeebd1

Browse files
committed
Try to implement IClosable that maps to System.IDisposable in .Net
Doc: https://learn.microsoft.com/en-us/uwp/api/windows.foundation.iclosable
1 parent a0a3432 commit 5aeebd1

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

MyInterfaces/MyInterfaces.idl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,34 @@ cpp_quote("extern \"C\"{")
7272
cpp_quote("#endif")
7373

7474

75+
/** Copied as-is from "winrt\hstring.idl" */
76+
typedef struct HSTRING__ {
77+
int unused;
78+
} HSTRING__;
79+
typedef [wire_marshal(wireBSTR), unique] HSTRING__* HSTRING;
80+
81+
/** Copied as-is from "winrt\inspectable.idl" */
82+
typedef [v1_enum] enum TrustLevel
83+
{
84+
BaseTrust,
85+
PartialTrust,
86+
FullTrust
87+
} TrustLevel;
88+
89+
/** Copied as-is from "winrt\inspectable.h" */
90+
[object, uuid(AF86E2E0-B12D-4c6a-9C5A-D7AA65101E90), pointer_default(unique)]
91+
interface IInspectable : IUnknown {
92+
HRESULT GetIids([out] ULONG* iidCount, [out, size_is(, *iidCount)] IID** iids);
93+
HRESULT GetRuntimeClassName([out] HSTRING* className);
94+
HRESULT GetTrustLevel([out] TrustLevel* trustLevel);
95+
};
96+
97+
/** Copied with simplifications from "winrt\windows.foundation.idl" */
98+
[uuid(30D5A829-7FA4-4026-83BB-D75BAE4EA99E)]
99+
interface IClosable : IInspectable {
100+
HRESULT Close();
101+
};
102+
75103
[object,
76104
oleautomation,
77105
uuid(BE3FF6C1-94F5-4974-913C-237C9AB29679),
@@ -110,5 +138,6 @@ library MyInterfaces {
110138
[uuid(AF080472-F173-4D9D-8BE7-435776617347)]
111139
coclass MyServer {
112140
[default] interface IMyServer;
141+
interface IClosable;
113142
}
114143
}

0 commit comments

Comments
 (0)