WinApi.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. //---------------------------------------------------------------------------
  2. #ifndef WinApiH
  3. #define WinApiH
  4. //---------------------------------------------------------------------------
  5. // For other API definitions, see also PasTools.pas
  6. //---------------------------------------------------------------------------
  7. #include <shlobj.h>
  8. //---------------------------------------------------------------------------
  9. typedef BOOL WINAPI (* ChangeWindowMessageFilterExProc)(
  10. HWND hwnd, UINT message, DWORD action, PCHANGEFILTERSTRUCT pChangeFilterStruct);
  11. typedef BOOL WINAPI (* AddClipboardFormatListenerProc)(HWND hwnd);
  12. typedef BOOL WINAPI (* RemoveClipboardFormatListenerProc)(HWND hwnd);
  13. //---------------------------------------------------------------------------
  14. #define WM_DPICHANGED 0x02E0
  15. #define WM_GETDPISCALEDSIZE 0x02E4
  16. //---------------------------------------------------------------------------
  17. typedef enum _Monitor_DPI_Type {
  18. MDT_Effective_DPI = 0,
  19. MDT_Angular_DPI = 1,
  20. MDT_Raw_DPI = 2,
  21. MDT_Default = MDT_Effective_DPI
  22. } MONITOR_DPI_TYPE;
  23. //---------------------------------------------------------------------------
  24. typedef HRESULT WINAPI (* GetDpiForMonitorProc)(
  25. HMONITOR hmonitor, MONITOR_DPI_TYPE dpiType, UINT * dpiX, UINT * dpiY);
  26. //---------------------------------------------------------------------------
  27. //---------------------------------------------------------------------------
  28. // Taken from https://www.codeproject.com/Articles/35197/Undocumented-List-View-Features
  29. //---------------------------------------------------------------------------
  30. #define LVM_QUERYINTERFACE (LVM_FIRST + 189)
  31. //---------------------------------------------------------------------------
  32. // the interface's GUID
  33. extern const IID IID_IListView_Win7;
  34. //---------------------------------------------------------------------------
  35. class IOwnerDataCallback; // we do not need this interface, so we do not define it
  36. //---------------------------------------------------------------------------
  37. class IListView_Win7 : public IOleWindow
  38. {
  39. public:
  40. virtual HRESULT STDMETHODCALLTYPE GetImageList(int imageList, HIMAGELIST* pHImageList) = 0;
  41. virtual HRESULT STDMETHODCALLTYPE SetImageList(int imageList, HIMAGELIST hNewImageList, HIMAGELIST* pHOldImageList) = 0;
  42. virtual HRESULT STDMETHODCALLTYPE GetBackgroundColor(COLORREF* pColor) = 0;
  43. virtual HRESULT STDMETHODCALLTYPE SetBackgroundColor(COLORREF color) = 0;
  44. virtual HRESULT STDMETHODCALLTYPE GetTextColor(COLORREF* pColor) = 0;
  45. virtual HRESULT STDMETHODCALLTYPE SetTextColor(COLORREF color) = 0;
  46. virtual HRESULT STDMETHODCALLTYPE GetTextBackgroundColor(COLORREF* pColor) = 0;
  47. virtual HRESULT STDMETHODCALLTYPE SetTextBackgroundColor(COLORREF color) = 0;
  48. virtual HRESULT STDMETHODCALLTYPE GetHotLightColor(COLORREF* pColor) = 0;
  49. virtual HRESULT STDMETHODCALLTYPE SetHotLightColor(COLORREF color) = 0;
  50. virtual HRESULT STDMETHODCALLTYPE GetItemCount(PINT pItemCount) = 0;
  51. virtual HRESULT STDMETHODCALLTYPE SetItemCount(int itemCount, DWORD flags) = 0;
  52. virtual HRESULT STDMETHODCALLTYPE GetItem(LVITEMW* pItem) = 0;
  53. virtual HRESULT STDMETHODCALLTYPE SetItem(LVITEMW* const pItem) = 0;
  54. virtual HRESULT STDMETHODCALLTYPE GetItemState(int itemIndex, int subItemIndex, ULONG mask, ULONG* pState) = 0;
  55. virtual HRESULT STDMETHODCALLTYPE SetItemState(int itemIndex, int subItemIndex, ULONG mask, ULONG state) = 0;
  56. virtual HRESULT STDMETHODCALLTYPE GetItemText(int itemIndex, int subItemIndex, LPWSTR pBuffer, int bufferSize) = 0;
  57. virtual HRESULT STDMETHODCALLTYPE SetItemText(int itemIndex, int subItemIndex, LPCWSTR pText) = 0;
  58. virtual HRESULT STDMETHODCALLTYPE GetBackgroundImage(LVBKIMAGEW* pBkImage) = 0;
  59. virtual HRESULT STDMETHODCALLTYPE SetBackgroundImage(LVBKIMAGEW* const pBkImage) = 0;
  60. virtual HRESULT STDMETHODCALLTYPE GetFocusedColumn(PINT pColumnIndex) = 0;
  61. // parameters may be in wrong order
  62. virtual HRESULT STDMETHODCALLTYPE SetSelectionFlags(ULONG mask, ULONG flags) = 0;
  63. virtual HRESULT STDMETHODCALLTYPE GetSelectedColumn(PINT pColumnIndex) = 0;
  64. virtual HRESULT STDMETHODCALLTYPE SetSelectedColumn(int columnIndex) = 0;
  65. virtual HRESULT STDMETHODCALLTYPE GetView(DWORD* pView) = 0;
  66. virtual HRESULT STDMETHODCALLTYPE SetView(DWORD view) = 0;
  67. virtual HRESULT STDMETHODCALLTYPE InsertItem(LVITEMW* const pItem, PINT pItemIndex) = 0;
  68. virtual HRESULT STDMETHODCALLTYPE DeleteItem(int itemIndex) = 0;
  69. virtual HRESULT STDMETHODCALLTYPE DeleteAllItems(void) = 0;
  70. virtual HRESULT STDMETHODCALLTYPE UpdateItem(int itemIndex) = 0;
  71. virtual HRESULT STDMETHODCALLTYPE GetItemRect(LVITEMINDEX itemIndex, int rectangleType, LPRECT pRectangle) = 0;
  72. virtual HRESULT STDMETHODCALLTYPE GetSubItemRect(LVITEMINDEX itemIndex, int subItemIndex, int rectangleType, LPRECT pRectangle) = 0;
  73. virtual HRESULT STDMETHODCALLTYPE HitTestSubItem(LVHITTESTINFO* pHitTestData) = 0;
  74. virtual HRESULT STDMETHODCALLTYPE GetIncrSearchString(PWSTR pBuffer, int bufferSize, PINT pCopiedChars) = 0;
  75. // pHorizontalSpacing and pVerticalSpacing may be in wrong order
  76. virtual HRESULT STDMETHODCALLTYPE GetItemSpacing(BOOL smallIconView, PINT pHorizontalSpacing, PINT pVerticalSpacing) = 0;
  77. // parameters may be in wrong order
  78. virtual HRESULT STDMETHODCALLTYPE SetIconSpacing(int horizontalSpacing, int verticalSpacing, PINT pHorizontalSpacing, PINT pVerticalSpacing) = 0;
  79. virtual HRESULT STDMETHODCALLTYPE GetNextItem(LVITEMINDEX itemIndex, ULONG flags, LVITEMINDEX* pNextItemIndex) = 0;
  80. virtual HRESULT STDMETHODCALLTYPE FindItem(LVITEMINDEX startItemIndex, LVFINDINFOW const* pFindInfo, LVITEMINDEX* pFoundItemIndex) = 0;
  81. virtual HRESULT STDMETHODCALLTYPE GetSelectionMark(LVITEMINDEX* pSelectionMark) = 0;
  82. virtual HRESULT STDMETHODCALLTYPE SetSelectionMark(LVITEMINDEX newSelectionMark, LVITEMINDEX* pOldSelectionMark) = 0;
  83. virtual HRESULT STDMETHODCALLTYPE GetItemPosition(LVITEMINDEX itemIndex, POINT* pPosition) = 0;
  84. virtual HRESULT STDMETHODCALLTYPE SetItemPosition(int itemIndex, POINT const* pPosition) = 0;
  85. // parameters may be in wrong order
  86. virtual HRESULT STDMETHODCALLTYPE ScrollView(int horizontalScrollDistance, int verticalScrollDistance) = 0;
  87. virtual HRESULT STDMETHODCALLTYPE EnsureItemVisible(LVITEMINDEX itemIndex, BOOL partialOk) = 0;
  88. virtual HRESULT STDMETHODCALLTYPE EnsureSubItemVisible(LVITEMINDEX itemIndex, int subItemIndex) = 0;
  89. virtual HRESULT STDMETHODCALLTYPE EditSubItem(LVITEMINDEX itemIndex, int subItemIndex) = 0;
  90. virtual HRESULT STDMETHODCALLTYPE RedrawItems(int firstItemIndex, int lastItemIndex) = 0;
  91. virtual HRESULT STDMETHODCALLTYPE ArrangeItems(int mode) = 0;
  92. virtual HRESULT STDMETHODCALLTYPE RecomputeItems(int unknown) = 0;
  93. virtual HRESULT STDMETHODCALLTYPE GetEditControl(HWND* pHWndEdit) = 0;
  94. // TODO: verify that 'initialEditText' really is used to specify the initial text
  95. virtual HRESULT STDMETHODCALLTYPE EditLabel(LVITEMINDEX itemIndex, LPCWSTR initialEditText, HWND* phWndEdit) = 0;
  96. virtual HRESULT STDMETHODCALLTYPE EditGroupLabel(int groupIndex) = 0;
  97. virtual HRESULT STDMETHODCALLTYPE CancelEditLabel(void) = 0;
  98. virtual HRESULT STDMETHODCALLTYPE GetEditItem(LVITEMINDEX* itemIndex, PINT subItemIndex) = 0;
  99. virtual HRESULT STDMETHODCALLTYPE HitTest(LVHITTESTINFO* pHitTestData) = 0;
  100. virtual HRESULT STDMETHODCALLTYPE GetStringWidth(PCWSTR pString, PINT pWidth) = 0;
  101. virtual HRESULT STDMETHODCALLTYPE GetColumn(int columnIndex, LVCOLUMNW* pColumn) = 0;
  102. virtual HRESULT STDMETHODCALLTYPE SetColumn(int columnIndex, LVCOLUMNW* const pColumn) = 0;
  103. virtual HRESULT STDMETHODCALLTYPE GetColumnOrderArray(int numberOfColumns, PINT pColumns) = 0;
  104. virtual HRESULT STDMETHODCALLTYPE SetColumnOrderArray(int numberOfColumns, int const* pColumns) = 0;
  105. virtual HRESULT STDMETHODCALLTYPE GetHeaderControl(HWND* pHWndHeader) = 0;
  106. virtual HRESULT STDMETHODCALLTYPE InsertColumn(int insertAt, LVCOLUMNW* const pColumn, PINT pColumnIndex) = 0;
  107. virtual HRESULT STDMETHODCALLTYPE DeleteColumn(int columnIndex) = 0;
  108. virtual HRESULT STDMETHODCALLTYPE CreateDragImage(int itemIndex, POINT const* pUpperLeft, HIMAGELIST* pHImageList) = 0;
  109. virtual HRESULT STDMETHODCALLTYPE GetViewRect(RECT* pRectangle) = 0;
  110. virtual HRESULT STDMETHODCALLTYPE GetClientRect(BOOL unknown, RECT* pClientRectangle) = 0;
  111. virtual HRESULT STDMETHODCALLTYPE GetColumnWidth(int columnIndex, PINT pWidth) = 0;
  112. virtual HRESULT STDMETHODCALLTYPE SetColumnWidth(int columnIndex, int width) = 0;
  113. virtual HRESULT STDMETHODCALLTYPE GetCallbackMask(ULONG* pMask) = 0;
  114. virtual HRESULT STDMETHODCALLTYPE SetCallbackMask(ULONG mask) = 0;
  115. virtual HRESULT STDMETHODCALLTYPE GetTopIndex(PINT pTopIndex) = 0;
  116. virtual HRESULT STDMETHODCALLTYPE GetCountPerPage(PINT pCountPerPage) = 0;
  117. virtual HRESULT STDMETHODCALLTYPE GetOrigin(POINT* pOrigin) = 0;
  118. virtual HRESULT STDMETHODCALLTYPE GetSelectedCount(PINT pSelectedCount) = 0;
  119. // 'unknown' might specify whether to pass items' data or indexes
  120. virtual HRESULT STDMETHODCALLTYPE SortItems(BOOL unknown, LPARAM lParam, PFNLVCOMPARE pComparisonFunction) = 0;
  121. virtual HRESULT STDMETHODCALLTYPE GetExtendedStyle(DWORD* pStyle) = 0;
  122. // parameters may be in wrong order
  123. virtual HRESULT STDMETHODCALLTYPE SetExtendedStyle(DWORD mask, DWORD style, DWORD* pOldStyle) = 0;
  124. virtual HRESULT STDMETHODCALLTYPE GetHoverTime(UINT* pTime) = 0;
  125. virtual HRESULT STDMETHODCALLTYPE SetHoverTime(UINT time, UINT* pOldSetting) = 0;
  126. virtual HRESULT STDMETHODCALLTYPE GetToolTip(HWND* pHWndToolTip) = 0;
  127. virtual HRESULT STDMETHODCALLTYPE SetToolTip(HWND hWndToolTip, HWND* pHWndOldToolTip) = 0;
  128. virtual HRESULT STDMETHODCALLTYPE GetHotItem(LVITEMINDEX* pHotItem) = 0;
  129. virtual HRESULT STDMETHODCALLTYPE SetHotItem(LVITEMINDEX newHotItem, LVITEMINDEX* pOldHotItem) = 0;
  130. virtual HRESULT STDMETHODCALLTYPE GetHotCursor(HCURSOR* pHCursor) = 0;
  131. virtual HRESULT STDMETHODCALLTYPE SetHotCursor(HCURSOR hCursor, HCURSOR* pHOldCursor) = 0;
  132. // parameters may be in wrong order
  133. virtual HRESULT STDMETHODCALLTYPE ApproximateViewRect(int itemCount, PINT pWidth, PINT pHeight) = 0;
  134. virtual HRESULT STDMETHODCALLTYPE SetRangeObject(int unknown, LPVOID/*ILVRange**/ pObject) = 0;
  135. virtual HRESULT STDMETHODCALLTYPE GetWorkAreas(int numberOfWorkAreas, RECT* pWorkAreas) = 0;
  136. virtual HRESULT STDMETHODCALLTYPE SetWorkAreas(int numberOfWorkAreas, RECT const* pWorkAreas) = 0;
  137. virtual HRESULT STDMETHODCALLTYPE GetWorkAreaCount(PINT pNumberOfWorkAreas) = 0;
  138. virtual HRESULT STDMETHODCALLTYPE ResetEmptyText(void) = 0;
  139. virtual HRESULT STDMETHODCALLTYPE EnableGroupView(BOOL enable) = 0;
  140. virtual HRESULT STDMETHODCALLTYPE IsGroupViewEnabled(BOOL* pIsEnabled) = 0;
  141. virtual HRESULT STDMETHODCALLTYPE SortGroups(::PFNLVGROUPCOMPARE pComparisonFunction, PVOID lParam) = 0;
  142. virtual HRESULT STDMETHODCALLTYPE GetGroupInfo(int unknown1, int unknown2, LVGROUP* pGroup) = 0;
  143. virtual HRESULT STDMETHODCALLTYPE SetGroupInfo(int unknown, int groupID, LVGROUP* const pGroup) = 0;
  144. virtual HRESULT STDMETHODCALLTYPE GetGroupRect(BOOL unknown, int groupID, int rectangleType, RECT* pRectangle) = 0;
  145. virtual HRESULT STDMETHODCALLTYPE GetGroupState(int groupID, ULONG mask, ULONG* pState) = 0;
  146. virtual HRESULT STDMETHODCALLTYPE HasGroup(int groupID, BOOL* pHasGroup) = 0;
  147. virtual HRESULT STDMETHODCALLTYPE InsertGroup(int insertAt, LVGROUP* const pGroup, PINT pGroupID) = 0;
  148. virtual HRESULT STDMETHODCALLTYPE RemoveGroup(int groupID) = 0;
  149. virtual HRESULT STDMETHODCALLTYPE InsertGroupSorted(LVINSERTGROUPSORTED const* pGroup, PINT pGroupID) = 0;
  150. virtual HRESULT STDMETHODCALLTYPE GetGroupMetrics(LVGROUPMETRICS* pMetrics) = 0;
  151. virtual HRESULT STDMETHODCALLTYPE SetGroupMetrics(LVGROUPMETRICS* const pMetrics) = 0;
  152. virtual HRESULT STDMETHODCALLTYPE RemoveAllGroups(void) = 0;
  153. virtual HRESULT STDMETHODCALLTYPE GetFocusedGroup(PINT pGroupID) = 0;
  154. virtual HRESULT STDMETHODCALLTYPE GetGroupCount(PINT pCount) = 0;
  155. virtual HRESULT STDMETHODCALLTYPE SetOwnerDataCallback(IOwnerDataCallback* pCallback) = 0;
  156. virtual HRESULT STDMETHODCALLTYPE GetTileViewInfo(LVTILEVIEWINFO* pInfo) = 0;
  157. virtual HRESULT STDMETHODCALLTYPE SetTileViewInfo(LVTILEVIEWINFO* const pInfo) = 0;
  158. virtual HRESULT STDMETHODCALLTYPE GetTileInfo(LVTILEINFO* pTileInfo) = 0;
  159. virtual HRESULT STDMETHODCALLTYPE SetTileInfo(LVTILEINFO* const pTileInfo) = 0;
  160. virtual HRESULT STDMETHODCALLTYPE GetInsertMark(LVINSERTMARK* pInsertMarkDetails) = 0;
  161. virtual HRESULT STDMETHODCALLTYPE SetInsertMark(LVINSERTMARK const* pInsertMarkDetails) = 0;
  162. virtual HRESULT STDMETHODCALLTYPE GetInsertMarkRect(LPRECT pInsertMarkRectangle) = 0;
  163. virtual HRESULT STDMETHODCALLTYPE GetInsertMarkColor(COLORREF* pColor) = 0;
  164. virtual HRESULT STDMETHODCALLTYPE SetInsertMarkColor(COLORREF color, COLORREF* pOldColor) = 0;
  165. virtual HRESULT STDMETHODCALLTYPE HitTestInsertMark(POINT const* pPoint, LVINSERTMARK* pInsertMarkDetails) = 0;
  166. virtual HRESULT STDMETHODCALLTYPE SetInfoTip(LVSETINFOTIP* const pInfoTip) = 0;
  167. virtual HRESULT STDMETHODCALLTYPE GetOutlineColor(COLORREF* pColor) = 0;
  168. virtual HRESULT STDMETHODCALLTYPE SetOutlineColor(COLORREF color, COLORREF* pOldColor) = 0;
  169. virtual HRESULT STDMETHODCALLTYPE GetFrozenItem(PINT pItemIndex) = 0;
  170. // one parameter will be the item index; works in Icons view only
  171. virtual HRESULT STDMETHODCALLTYPE SetFrozenItem(int unknown1, int unknown2) = 0;
  172. virtual HRESULT STDMETHODCALLTYPE GetFrozenSlot(RECT* pUnknown) = 0;
  173. virtual HRESULT STDMETHODCALLTYPE SetFrozenSlot(int unknown1, POINT const* pUnknown2) = 0;
  174. virtual HRESULT STDMETHODCALLTYPE GetViewMargin(RECT* pMargin) = 0;
  175. virtual HRESULT STDMETHODCALLTYPE SetViewMargin(RECT const* pMargin) = 0;
  176. virtual HRESULT STDMETHODCALLTYPE SetKeyboardSelected(LVITEMINDEX itemIndex) = 0;
  177. virtual HRESULT STDMETHODCALLTYPE MapIndexToId(int itemIndex, PINT pItemID) = 0;
  178. virtual HRESULT STDMETHODCALLTYPE MapIdToIndex(int itemID, PINT pItemIndex) = 0;
  179. virtual HRESULT STDMETHODCALLTYPE IsItemVisible(LVITEMINDEX itemIndex, BOOL* pVisible) = 0;
  180. virtual HRESULT STDMETHODCALLTYPE EnableAlphaShadow(BOOL enable) = 0;
  181. virtual HRESULT STDMETHODCALLTYPE GetGroupSubsetCount(PINT pNumberOfRowsDisplayed) = 0;
  182. virtual HRESULT STDMETHODCALLTYPE SetGroupSubsetCount(int numberOfRowsToDisplay) = 0;
  183. virtual HRESULT STDMETHODCALLTYPE GetVisibleSlotCount(PINT pCount) = 0;
  184. virtual HRESULT STDMETHODCALLTYPE GetColumnMargin(RECT* pMargin) = 0;
  185. virtual HRESULT STDMETHODCALLTYPE SetSubItemCallback(LPVOID/*ISubItemCallback**/ pCallback) = 0;
  186. virtual HRESULT STDMETHODCALLTYPE GetVisibleItemRange(LVITEMINDEX* pFirstItem, LVITEMINDEX* pLastItem) = 0;
  187. virtual HRESULT STDMETHODCALLTYPE SetTypeAheadFlags(UINT mask, UINT flags) = 0;
  188. };
  189. //---------------------------------------------------------------------------
  190. //---------------------------------------------------------------------------
  191. #define EM_SETEDITSTYLEEX (WM_USER + 275)
  192. #define SES_EX_HANDLEFRIENDLYURL (0x100)
  193. //---------------------------------------------------------------------------
  194. //---------------------------------------------------------------------------
  195. typedef struct HSTRING__{
  196. int unused;
  197. } HSTRING__;
  198. typedef HSTRING__* HSTRING;
  199. //---------------------------------------------------------------------------
  200. // Windows Kits\10\Include\10.0.16299.0\winrt\inspectable.h
  201. typedef enum TrustLevel {
  202. BaseTrust = 0,
  203. PartialTrust,
  204. FullTrust
  205. } TrustLevel;
  206. //---------------------------------------------------------------------------
  207. class IInspectable : public IUnknown
  208. {
  209. public:
  210. virtual HRESULT STDMETHODCALLTYPE GetIids(
  211. /* [out] */ __RPC__out ULONG *iidCount,
  212. /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids) = 0;
  213. virtual HRESULT STDMETHODCALLTYPE GetRuntimeClassName(
  214. /* [out] */ __RPC__deref_out_opt HSTRING *className) = 0;
  215. virtual HRESULT STDMETHODCALLTYPE GetTrustLevel(
  216. /* [out] */ __RPC__out TrustLevel *trustLevel) = 0;
  217. };
  218. //---------------------------------------------------------------------------
  219. template <class T>
  220. struct not_yet_specialized_placeholder
  221. {
  222. enum { value = false };
  223. };
  224. //---------------------------------------------------------------------------
  225. template <class WasNotSpecialized>
  226. struct not_yet_specialized
  227. {
  228. };
  229. //---------------------------------------------------------------------------
  230. template <class T>
  231. struct GetAbiType
  232. {
  233. typedef T type;
  234. };
  235. //---------------------------------------------------------------------------
  236. template <class T>
  237. struct GetLogicalType
  238. {
  239. typedef T type;
  240. };
  241. //---------------------------------------------------------------------------
  242. #define IAsyncOperationCompletedHandlerStoreAppLicenseGUID L"{ceff1e09-e506-50ad-a908-52038c256552}"
  243. template <class TResult>
  244. struct IAsyncOperationCompletedHandler_impl;
  245. template <class TResult>
  246. struct IAsyncOperationCompletedHandler
  247. : public IAsyncOperationCompletedHandler_impl<TResult>
  248. , not_yet_specialized<IAsyncOperationCompletedHandler<TResult> >
  249. {
  250. };
  251. //---------------------------------------------------------------------------
  252. template <class TResult>
  253. struct IAsyncOperation_impl : IInspectable
  254. {
  255. private:
  256. typedef typename GetAbiType<TResult>::type TResult_abi;
  257. typedef typename GetLogicalType<TResult>::type TResult_logical;
  258. public:
  259. // For all types which are neither InterfaceGroups nor RuntimeClasses, the
  260. // following three typedefs are synonyms for a single C++ type. But for
  261. // InterfaceGroups and RuntimeClasses, they are different types:
  262. // T_logical: The C++ Type for the InterfaceGroup or RuntimeClass, when
  263. // used as a template parameter. Eg "RCFoo*"
  264. // T_abi: The C++ type for the default interface used to represent the
  265. // InterfaceGroup or RuntimeClass when passed as a method parameter.
  266. // Eg "IFoo*"
  267. // T_complex: An instantiation of the Internal "AggregateType" template that
  268. // combines T_logical with T_abi. Eg "AggregateType<RCFoo*,IFoo*>"
  269. // See the declaration above of Windows::Foundation::Internal::AggregateType
  270. // for more details.
  271. typedef TResult TResult_complex;
  272. virtual HRESULT STDMETHODCALLTYPE put_Completed( IAsyncOperationCompletedHandler<TResult_logical> *handler) = 0;
  273. virtual HRESULT STDMETHODCALLTYPE get_Completed( IAsyncOperationCompletedHandler<TResult_logical> **handler) = 0;
  274. virtual HRESULT STDMETHODCALLTYPE GetResults( TResult_abi *results) = 0;
  275. };
  276. //---------------------------------------------------------------------------
  277. // Windows Kits\10\Include\10.0.16299.0\winrt\windows.foundation.collections.h
  278. template <class TResult>
  279. struct IAsyncOperation_RT // Conflict with shldisp.h IAsyncOperation
  280. : IAsyncOperation_impl<TResult>
  281. , not_yet_specialized<IAsyncOperation_RT<TResult> >
  282. {
  283. };
  284. //---------------------------------------------------------------------------
  285. enum class AsyncStatus {
  286. Started = 0,
  287. Completed,
  288. Canceled,
  289. Error,
  290. };
  291. //---------------------------------------------------------------------------
  292. template <class TResult>
  293. struct IAsyncOperationCompletedHandler_impl : public IUnknown
  294. {
  295. private:
  296. typedef typename GetAbiType<TResult>::type TResult_abi;
  297. typedef typename GetLogicalType<TResult>::type TResult_logical;
  298. public:
  299. // For all types which are neither InterfaceGroups nor RuntimeClasses, the
  300. // following three typedefs are synonyms for a single C++ type. But for
  301. // InterfaceGroups and RuntimeClasses, they are different types:
  302. // T_logical: The C++ Type for the InterfaceGroup or RuntimeClass, when
  303. // used as a template parameter. Eg "RCFoo*"
  304. // T_abi: The C++ type for the default interface used to represent the
  305. // InterfaceGroup or RuntimeClass when passed as a method parameter.
  306. // Eg "IFoo*"
  307. // T_complex: An instantiation of the Internal "AggregateType" template that
  308. // combines T_logical with T_abi. Eg "AggregateType<RCFoo*,IFoo*>"
  309. // See the declaration above of Windows::Foundation::Internal::AggregateType
  310. // for more details.
  311. typedef TResult TResult_complex;
  312. virtual HRESULT STDMETHODCALLTYPE Invoke(IAsyncOperation_RT<TResult> *asyncInfo, AsyncStatus status) = 0;
  313. };
  314. //---------------------------------------------------------------------------
  315. //---------------------------------------------------------------------------
  316. #define IStoreContextStaticsGUID L"{9C06EE5F-15C0-4E72-9330-D6191CEBD19C}"
  317. // Windows Kits\10\Include\10.0.16299.0\winrt\windows.services.store.h
  318. class IStoreContext : public IInspectable
  319. {
  320. public:
  321. /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_User(
  322. /* [retval, out] */__RPC__deref_out_opt /*ABI::Windows::System::IUser*/IUnknown * * value
  323. ) = 0;
  324. /* [eventadd] */virtual HRESULT STDMETHODCALLTYPE add_OfflineLicensesChanged(
  325. /* [in] */__RPC__in_opt /*__FITypedEventHandler_2_Windows__CServices__CStore__CStoreContext_IInspectable*/IUnknown * handler,
  326. /* [retval, out] */__RPC__out /*EventRegistrationToken*/__int64 * token
  327. ) = 0;
  328. /* [eventremove] */virtual HRESULT STDMETHODCALLTYPE remove_OfflineLicensesChanged(
  329. /* [in] *//*EventRegistrationToken*/__int64 token
  330. ) = 0;
  331. virtual HRESULT STDMETHODCALLTYPE GetCustomerPurchaseIdAsync(
  332. /* [in] */__RPC__in HSTRING serviceTicket,
  333. /* [in] */__RPC__in HSTRING publisherUserId,
  334. /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_HSTRING*/IUnknown * * operation
  335. ) = 0;
  336. virtual HRESULT STDMETHODCALLTYPE GetCustomerCollectionsIdAsync(
  337. /* [in] */__RPC__in HSTRING serviceTicket,
  338. /* [in] */__RPC__in HSTRING publisherUserId,
  339. /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_HSTRING*/IUnknown * * operation
  340. ) = 0;
  341. virtual HRESULT STDMETHODCALLTYPE GetAppLicenseAsync(
  342. /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreAppLicense*/IUnknown * * operation
  343. ) = 0;
  344. virtual HRESULT STDMETHODCALLTYPE GetStoreProductForCurrentAppAsync(
  345. /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreProductResult*/IUnknown * * operation
  346. ) = 0;
  347. virtual HRESULT STDMETHODCALLTYPE GetStoreProductsAsync(
  348. /* [in] */__RPC__in_opt /*__FIIterable_1_HSTRING*/IUnknown * productKinds,
  349. /* [in] */__RPC__in_opt /*__FIIterable_1_HSTRING*/IUnknown * storeIds,
  350. /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreProductQueryResult*/IUnknown * * operation
  351. ) = 0;
  352. virtual HRESULT STDMETHODCALLTYPE GetAssociatedStoreProductsAsync(
  353. /* [in] */__RPC__in_opt /*__FIIterable_1_HSTRING*/IUnknown * productKinds,
  354. /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreProductQueryResult*/IUnknown * * operation
  355. ) = 0;
  356. virtual HRESULT STDMETHODCALLTYPE GetAssociatedStoreProductsWithPagingAsync(
  357. /* [in] */__RPC__in_opt /*__FIIterable_1_HSTRING*/IUnknown * productKinds,
  358. /* [in] */UINT32 maxItemsToRetrievePerPage,
  359. /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreProductPagedQueryResult*/IUnknown * * operation
  360. ) = 0;
  361. virtual HRESULT STDMETHODCALLTYPE GetUserCollectionAsync(
  362. /* [in] */__RPC__in_opt /*__FIIterable_1_HSTRING*/IUnknown * productKinds,
  363. /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreProductQueryResult*/IUnknown * * operation
  364. ) = 0;
  365. virtual HRESULT STDMETHODCALLTYPE GetUserCollectionWithPagingAsync(
  366. /* [in] */__RPC__in_opt /*__FIIterable_1_HSTRING*/IUnknown * productKinds,
  367. /* [in] */UINT32 maxItemsToRetrievePerPage,
  368. /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreProductPagedQueryResult*/IUnknown * * operation
  369. ) = 0;
  370. virtual HRESULT STDMETHODCALLTYPE ReportConsumableFulfillmentAsync(
  371. /* [in] */__RPC__in HSTRING productStoreId,
  372. /* [in] */UINT32 quantity,
  373. /* [in] */GUID trackingId,
  374. /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreConsumableResult*/IUnknown * * operation
  375. ) = 0;
  376. virtual HRESULT STDMETHODCALLTYPE GetConsumableBalanceRemainingAsync(
  377. /* [in] */__RPC__in HSTRING productStoreId,
  378. /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreConsumableResult*/IUnknown * * operation
  379. ) = 0;
  380. virtual HRESULT STDMETHODCALLTYPE AcquireStoreLicenseForOptionalPackageAsync(
  381. /* [in] */__RPC__in_opt /*ABI::Windows::ApplicationModel::IPackage*/IUnknown * optionalPackage,
  382. /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreAcquireLicenseResult*/IUnknown * * operation
  383. ) = 0;
  384. /* [overload] */virtual HRESULT STDMETHODCALLTYPE RequestPurchaseAsync(
  385. /* [in] */__RPC__in HSTRING storeId,
  386. /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStorePurchaseResult*/IUnknown * * operation
  387. ) = 0;
  388. /* [overload] */virtual HRESULT STDMETHODCALLTYPE RequestPurchaseWithPurchasePropertiesAsync(
  389. /* [in] */__RPC__in HSTRING storeId,
  390. /* [in] */__RPC__in_opt /*ABI::Windows::Services::Store::IStorePurchaseProperties*/IUnknown * storePurchaseProperties,
  391. /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStorePurchaseResult*/IUnknown * * operation
  392. ) = 0;
  393. virtual HRESULT STDMETHODCALLTYPE GetAppAndOptionalStorePackageUpdatesAsync(
  394. /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1___FIVectorView_1_Windows__CServices__CStore__CStorePackageUpdate*/IUnknown * * operation
  395. ) = 0;
  396. virtual HRESULT STDMETHODCALLTYPE RequestDownloadStorePackageUpdatesAsync(
  397. /* [in] */__RPC__in_opt /*__FIIterable_1_Windows__CServices__CStore__CStorePackageUpdate*/IUnknown * storePackageUpdates,
  398. /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperationWithProgress_2_Windows__CServices__CStore__CStorePackageUpdateResult_Windows__CServices__CStore__CStorePackageUpdateStatus*/IUnknown * * operation
  399. ) = 0;
  400. virtual HRESULT STDMETHODCALLTYPE RequestDownloadAndInstallStorePackageUpdatesAsync(
  401. /* [in] */__RPC__in_opt /*__FIIterable_1_Windows__CServices__CStore__CStorePackageUpdate*/IUnknown * storePackageUpdates,
  402. /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperationWithProgress_2_Windows__CServices__CStore__CStorePackageUpdateResult_Windows__CServices__CStore__CStorePackageUpdateStatus*/IUnknown * * operation
  403. ) = 0;
  404. virtual HRESULT STDMETHODCALLTYPE RequestDownloadAndInstallStorePackagesAsync(
  405. /* [in] */__RPC__in_opt /*__FIIterable_1_HSTRING*/IUnknown * storeIds,
  406. /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperationWithProgress_2_Windows__CServices__CStore__CStorePackageUpdateResult_Windows__CServices__CStore__CStorePackageUpdateStatus*/IUnknown * * operation
  407. ) = 0;
  408. };
  409. //---------------------------------------------------------------------------
  410. class IStoreContextStatics : public IInspectable
  411. {
  412. public:
  413. virtual HRESULT STDMETHODCALLTYPE GetDefault(
  414. /* [retval, out] */__RPC__deref_out_opt IStoreContext * * value
  415. ) = 0;
  416. virtual HRESULT STDMETHODCALLTYPE GetForUser(
  417. /* [in] */__RPC__in_opt /*ABI::Windows::System::IUser*/IUnknown * user,
  418. /* [retval, out] */__RPC__deref_out_opt IStoreContext * * value
  419. ) = 0;
  420. };
  421. //---------------------------------------------------------------------------
  422. class IStoreAppLicense : public IInspectable
  423. {
  424. public:
  425. /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_SkuStoreId(
  426. /* [retval, out] */__RPC__deref_out_opt HSTRING * value
  427. ) = 0;
  428. /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_IsActive(
  429. /* [retval, out] */__RPC__out boolean * value
  430. ) = 0;
  431. /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_IsTrial(
  432. /* [retval, out] */__RPC__out boolean * value
  433. ) = 0;
  434. /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_ExpirationDate(
  435. /* [retval, out] */__RPC__out /*ABI::Windows::Foundation::DateTime*/void * value
  436. ) = 0;
  437. /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_ExtendedJsonData(
  438. /* [retval, out] */__RPC__deref_out_opt HSTRING * value
  439. ) = 0;
  440. /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_AddOnLicenses(
  441. /* [retval, out] */__RPC__deref_out_opt /*__FIMapView_2_HSTRING_Windows__CServices__CStore__CStoreLicense*/IUnknown * * value
  442. ) = 0;
  443. /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_TrialTimeRemaining(
  444. /* [retval, out] */__RPC__out /*ABI::Windows::Foundation::TimeSpan*/void * value
  445. ) = 0;
  446. /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_IsTrialOwnedByThisUser(
  447. /* [retval, out] */__RPC__out boolean * value
  448. ) = 0;
  449. /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_TrialUniqueId(
  450. /* [retval, out] */__RPC__deref_out_opt HSTRING * value
  451. ) = 0;
  452. };
  453. //---------------------------------------------------------------------------
  454. //---------------------------------------------------------------------------
  455. #endif // WinApiH