This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```cpp | |
// Can be used in a similar way to .NET's Task.FromResult and PPL's concurrency::create_async (See https://github.com/microsoft/cppwinrt/issues/1036). | |
template <typename Result> | |
struct AsyncOperationWrapper : implements<AsyncOperationWrapper<Result>, Windows::Foundation::IAsyncOperation<Result>> | |
{ | |
public: | |
AsyncOperationWrapper(Result result) : m_Result(result) {} | |
auto Id() const noexcept | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#prgama once | |
#include <winerror.h> | |
#include <winrt/Windows.Foundation.h> | |
/// <summary> | |
/// Provides a base class to conveniently implement the IClosable interface. | |
/// </summary> | |
/// <remarks>Your derived class must provide a public or protected Dispose method which will be called by Close when the object hasn't been closed yet.</remarks> | |
template <typename Derived> | |
struct Disposable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__interface __declspec(uuid("b74ea3bc-43c1-521f-9c75-e5c15054d78c")) IApplicationWindow_HwndInterop : IInspectable | |
{ | |
// <summary> | |
// Gets the window handle of this AppWindow instance as a bit-blitted WindowId. | |
// </summary> | |
// <remarks>To get the actual ID, use [CoreAppWindowPreview::GetIdFromWindow](https://docs.microsoft.com/en-us/uwp/api/windows.ui.core.preview.coreappwindowpreview.getidfromwindow?view=winrt-22621). This method returns the handle (HWND) of the window. | |
HRESULT __stdcall get_WindowHandle(Windows::UI::WindowId* windowId) noexcept; | |
}; | |
using IsWindow = int(__stdcall*)(HWND hwnd); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <Windows.h> | |
#include <winstring.h> | |
#include <Windows.Foundation.h> | |
#pragma comment(lib, "OneCoreUAP.lib") | |
struct StackStringable final : ABI::Windows::Foundation::IStringable | |
{ | |
public: |