We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In case of using the WinToast lib in extensions, it wold be great to use AUMID from existing parent app shortcut.
bool WinToast::GetAUMIdForCurrentProcess(_Out_ std::wstring& aumid) { if (!isCompatible()) { DEBUG_MSG(L"Warning: Your system is not compatible with this library "); return(false); } // Thanks to: // https://stackoverflow.com/questions/59926644/listing-of-installed-apps-on-windows-10 // HRESULT hr = E_FAIL; std::wstring exePath(MAX_PATH, 0); DWORD written = GetModuleFileNameExW(GetCurrentProcess(), nullptr, &exePath[0], MAX_PATH); exePath.resize(written); CoInitialize(NULL); ComPtr<IShellItem> folder; if (SUCCEEDED(hr = SHCreateItemFromParsingName(L"shell:appsFolder", nullptr, IID_PPV_ARGS(&folder)))) { ComPtr<IEnumShellItems> enumItems; if (SUCCEEDED(hr = folder->BindToHandler(nullptr, BHID_EnumItems, IID_PPV_ARGS(&enumItems)))) { IShellItem* items; while (enumItems->Next(1, &items, nullptr) == S_OK) { // Get executable path. ComPtr<IShellItem> item = items; ComPtr<IPropertyStore> store; if (SUCCEEDED(item->BindToHandler(NULL, BHID_PropertyStore, IID_PPV_ARGS(&store)))) { wchar_t pvString[MAX_PATH] = { 0 }; PROPVARIANT propVarPath; PropVariantInit(&propVarPath); if (SUCCEEDED(store->GetValue(PKEY_Link_TargetParsingPath, &propVarPath))) { hr = DllImporter::PropVariantToString(propVarPath, pvString, MAX_PATH); PropVariantClear(&propVarPath); // Compare path. if (exePath == pvString) { PROPVARIANT appIdPropVar; PropVariantInit(&appIdPropVar); if (SUCCEEDED(hr = store->GetValue(PKEY_AppUserModel_ID, &appIdPropVar))) { hr = DllImporter::PropVariantToString(appIdPropVar, pvString, MAX_PATH); PropVariantClear(&appIdPropVar); if (SUCCEEDED(hr)) { aumid = pvString; break; } } } } } } } } CoUninitialize(); return(SUCCEEDED(hr)); }
The text was updated successfully, but these errors were encountered:
Thanks for the contribution; I have scheduled this change for version v1.4.0.
Closing this issue and moving it to #86
Sorry, something went wrong.
No branches or pull requests
In case of using the WinToast lib in extensions, it wold be great to use AUMID from existing parent app shortcut.
The text was updated successfully, but these errors were encountered: