Created
November 6, 2012 22:23
-
-
Save domenic/4028057 to your computer and use it in GitHub Desktop.
Programmatically running a Windows 8 Metro app
This file contains hidden or 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 <SDKDDKVer.h> | |
| #include <ShObjIdl.h> | |
| #include <tchar.h> | |
| int wmain(int argc, wchar_t* argv[]) | |
| { | |
| const wchar_t* appId = L"WinningJS-test-runner_aw9cjjms6ptaw!App"; | |
| CoInitialize(nullptr); | |
| IApplicationActivationManager* aam = nullptr; | |
| HRESULT hr = CoCreateInstance(CLSID_ApplicationActivationManager, nullptr, CLSCTX_INPROC_SERVER, | |
| IID_PPV_ARGS(&aam)); | |
| if (FAILED(hr)) { | |
| wprintf(L"Error creating ApplicationActivationManager"); | |
| return 1; | |
| } | |
| DWORD pid = 0; | |
| hr = aam->ActivateApplication(appId, nullptr, AO_NONE, &pid); | |
| if (FAILED(hr)) { | |
| wprintf(L"Error calling ActivateApplication"); | |
| return 1; | |
| } | |
| aam->Release(); | |
| CoUninitialize(); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment