Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CoInitializeEx(NULL, COINIT_MULTITHREADED);
- LPCWSTR appId = L"Microsoft.Windows.Photos_8wekyb3d8bbwe!App";
- LPCWSTR imageArg = L" C:\data\Users\Public\Pictures\image123.png";
- IApplicationActivationManager* paam = NULL;
- HRESULT hr = E_FAIL;
- __try
- {
- hr = CoCreateInstance(CLSID_ApplicationActivationManager, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&paam));
- if (FAILED(hr))
- {
- cout << "Error creating CoCreateINstance & HR is" <<hr<< endl;
- return 0;
- }
- DWORD pid = 0;
- hr = paam->ActivateApplication(appId, imageArg, AO_NONE, &pid);
- if (FAILED(hr))
- {
- cout << "Error in ActivateApplication call & HR is " <<hr<< endl;
- return 0;
- }
- cout << hex << hr;
- if (hr == 0)
- wprintf(L"Activated %s with pid %drn", appId, pid);
- }
- __finally
- {
- if (paam) paam->Release();
- }
- CoUninitialize();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement