mirror of
https://github.com/modernw/App-Installer-For-Windows-8.x-Reset.git
synced 2026-06-15 11:50:10 +10:00
Update the features about Notification and Cert.
This commit is contained in:
+27
-1
@@ -628,4 +628,30 @@ HRESULT FindAppxPackage (LPCWSTR lpPackageFullName, PKGMGR_FINDENUMCALLBACK pfCa
|
||||
[STAThread]
|
||||
LPCWSTR GetPackageManagerLastErrorCode () { return g_swExceptionCode.c_str (); }
|
||||
[STAThread]
|
||||
LPCWSTR GetPackageManagerLastErrorDetailMessage () { return g_swExceptionDetail.c_str (); }
|
||||
LPCWSTR GetPackageManagerLastErrorDetailMessage () { return g_swExceptionDetail.c_str (); }
|
||||
|
||||
HRESULT ActivateAppxApplication (LPCWSTR lpAppUserId, PDWORD pdwProcessId)
|
||||
{
|
||||
if (!lpAppUserId) return E_INVALIDARG;
|
||||
std::wstring strAppUserModelId (L"");
|
||||
if (lpAppUserId) strAppUserModelId += lpAppUserId;
|
||||
IApplicationActivationManager *spAppActivationManager = nullptr;
|
||||
destruct relaamgr ([&] () {
|
||||
if (spAppActivationManager) spAppActivationManager->Release ();
|
||||
spAppActivationManager = nullptr;
|
||||
});
|
||||
HRESULT hResult = E_INVALIDARG;
|
||||
if (!strAppUserModelId.empty ())
|
||||
{
|
||||
// Instantiate IApplicationActivationManager
|
||||
hResult = CoCreateInstance (CLSID_ApplicationActivationManager, NULL, CLSCTX_LOCAL_SERVER, IID_IApplicationActivationManager, (LPVOID *)&spAppActivationManager);
|
||||
if (SUCCEEDED (hResult))
|
||||
{
|
||||
// This call ensures that the app is launched as the foreground window
|
||||
hResult = CoAllowSetForegroundWindow (spAppActivationManager, NULL);
|
||||
// Launch the app
|
||||
if (SUCCEEDED (hResult)) hResult = spAppActivationManager->ActivateApplication (strAppUserModelId.c_str (), NULL, AO_NONE, pdwProcessId);
|
||||
}
|
||||
}
|
||||
return hResult;
|
||||
}
|
||||
Reference in New Issue
Block a user