HSPでAppIDs(Application Identity)を設定してみる(その3)。任意のタイミングでApplication Identityを設定する方法やっています。CommitとPKEY_AppUserModel_IDに5を追加しましたら、成功しました。
HSPでAppIDs(Application Identity)を設定してみる(その3)。任意のタイミングでApplication Identityを設定する方法やっています。CommitとPKEY_AppUserModel_IDに5を追加しましたら、成功しました。
#packopt name "test1"#uselib "shell32"#func SHGetPropertyStoreForWindow "SHGetPropertyStoreForWindow" sptr, sptr, sptr#func GetCurrentProcessExplicitAppUserModelID "GetCurrentProcessExplicitAppUserModelID" wptr#func SetCurrentProcessExplicitAppUserModelID "SetCurrentProcessExplicitAppUserModelID" wstr#uselib "Propsys"#func InitPropVariantFromString "InitPropVariantFromString" wstr, sptr#func InitPropVariantFromStringVector "InitPropVariantFromStringVector" wptr, int, sptr#func PropVariantToStringAlloc "PropVariantToStringAlloc" sptr, wptr#define IID_IPropertyStore "{886d8eeb-8cf2-4446-8d02-cdba1dbdcf99}"#define CLSID_PropertyStore "{e4796550-df61-448b-9193-13fc1341b163}"#usecom IPropertyStore IID_IPropertyStore CLSID_PropertyStore#comfunc IPropertyStore_SetValue 6 sptr, sptr#comfunc IPropertyStore_Commit 7propStorePtr = 0IID_IPropertyStore_Array = 0x886d8eeb, 0x44468cf2, 0xbacd028d, 0x99cfbd1dSHGetPropertyStoreForWindow hwnd, varptr(IID_IPropertyStore_Array), varptr(propStorePtr)if stat == 0{newcom propStore, IPropertyStore, -1, propStorePtr// Win7 では廃止されているらしい// propsys.dll 7.0/*mes varptr(InitPropVariantFromString)InitPropVariantFromString "net.hinekure.test.hsp3", varptr(ppropvar)*/// Unicodeに変換sdim wstringcnvstow wstring, "net.hinekure.test.hsp3"// 配列なので(今回は1つしかないけど)wstrings = varptr(wstring)// PROPVARIANT 構造体dim ppropvar, 4// Unicode文字列→PROPVARIANT に変換InitPropVariantFromStringVector varptr(wstrings), 1, varptr(ppropvar)mes strf("0x%08x, %d", stat, stat)PKEY_AppUserModel_ID = 0x9F4C2855, 0x4B399F79, 0xD4E1D0A8, 0xF3D5E12D, 5IPropertyStore_SetValue propStore, varptr(PKEY_AppUserModel_ID), varptr(ppropvar)mes strf("0x%08x, %d", stat, stat)IPropertyStore_Commit propStoremes strf("0x%08x, %d", stat, stat)}