Skip to content

Commit 30fefc8

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 30fefc8

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

MyInterfaces/MyInterfaces.idl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,33 @@ 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+
BaseTrust,
84+
PartialTrust,
85+
FullTrust
86+
} TrustLevel;
87+
88+
/** Copied as-is from "winrt\inspectable.h" */
89+
[object, uuid(AF86E2E0-B12D-4c6a-9C5A-D7AA65101E90), pointer_default(unique)]
90+
interface IInspectable : IUnknown {
91+
HRESULT GetIids([out] ULONG* iidCount, [out, size_is(, *iidCount)] IID** iids);
92+
HRESULT GetRuntimeClassName([out] HSTRING* className);
93+
HRESULT GetTrustLevel([out] TrustLevel* trustLevel);
94+
};
95+
96+
/** Copied with simplifications from "winrt\windows.foundation.idl" */
97+
[uuid(30D5A829-7FA4-4026-83BB-D75BAE4EA99E)]
98+
interface IClosable : IInspectable {
99+
HRESULT Close();
100+
};
101+
75102
[object,
76103
oleautomation,
77104
uuid(BE3FF6C1-94F5-4974-913C-237C9AB29679),
@@ -110,5 +137,6 @@ library MyInterfaces {
110137
[uuid(AF080472-F173-4D9D-8BE7-435776617347)]
111138
coclass MyServer {
112139
[default] interface IMyServer;
140+
interface IClosable;
113141
}
114142
}

0 commit comments

Comments
 (0)