mirror of
https://github.com/modernw/App-Installer-For-Windows-8.x-Reset.git
synced 2026-04-11 17:57:19 +10:00
Update manager and add features for App Installer.
This commit is contained in:
@@ -1003,3 +1003,33 @@ HRESULT WRTAppDataClearAll (HWRTAPPDATA hAppData, LPWSTR *pErrorCode, LPWSTR *pD
|
||||
}
|
||||
return E_FAIL;
|
||||
}
|
||||
[STAThread]
|
||||
HRESULT ActivateAppxApplicationWithArgs (LPCWSTR lpAppUserId, LPCWSTR lpArguments, PDWORD pdwProcessId)
|
||||
{
|
||||
HRESULT hr = CoInitializeEx (nullptr, COINIT_APARTMENTTHREADED);
|
||||
if (FAILED (hr) && hr != RPC_E_CHANGED_MODE) return hr;
|
||||
if (!lpAppUserId) return E_INVALIDARG;
|
||||
std::wstring appUserModelId (lpAppUserId);
|
||||
IApplicationActivationManager *pAam = nullptr;
|
||||
destruct autoRelease ([&] {
|
||||
if (pAam) pAam->Release ();
|
||||
});
|
||||
hr = CoCreateInstance (
|
||||
CLSID_ApplicationActivationManager,
|
||||
nullptr,
|
||||
CLSCTX_LOCAL_SERVER,
|
||||
IID_IApplicationActivationManager,
|
||||
(void **)&pAam
|
||||
);
|
||||
if (FAILED (hr)) return hr;
|
||||
CoAllowSetForegroundWindow (pAam, nullptr);
|
||||
DWORD pid = 0;
|
||||
hr = pAam->ActivateApplication (
|
||||
appUserModelId.c_str (),
|
||||
lpArguments && *lpArguments ? lpArguments : nullptr, // 允许空
|
||||
AO_NONE,
|
||||
&pid
|
||||
);
|
||||
if (SUCCEEDED (hr) && pdwProcessId) *pdwProcessId = pid;
|
||||
return hr;
|
||||
}
|
||||
|
||||
@@ -203,6 +203,8 @@ extern "C"
|
||||
PKGMGR_API HRESULT CreateAppDataManager (LPCWSTR lpFamilyName, HWRTAPPDATA *ppApplicationData, LPWSTR *pErrorCode, LPWSTR *pDetailMsg);
|
||||
// 从本地、漫游和临时应用数据存储中删除所有应用程序数据。
|
||||
PKGMGR_API HRESULT WRTAppDataClearAll (HWRTAPPDATA hAppData, LPWSTR *pErrorCode, LPWSTR *pDetailMsg);
|
||||
|
||||
PKGMGR_API HRESULT ActivateAppxApplicationWithArgs (LPCWSTR lpAppUserId, LPCWSTR lpArguments, PDWORD pdwProcessId);
|
||||
#ifdef _DEFAULT_INIT_VALUE_
|
||||
#undef _DEFAULT_INIT_VALUE_
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user