Beispiel #1
0
        /// <summary>
        /// Sets the application user model id for the window.
        /// </summary>
        /// <param name="hwnd">The window.</param>
        /// <param name="appId">The application id to set.</param>
        public static void SetWindowAppId(IntPtr hwnd, string appId)
        {
            var iPropertyStoreGuid = new Guid("886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99");

            SHGetPropertyStoreForWindow(hwnd, ref iPropertyStoreGuid, out IPropertyStore propertyStore);
            var appid = new PROPVARIANT(appId);

            propertyStore.SetValue(ref PropertyKey.SystemAppUserModelIDPropertyKey, appid);
            PROPVARIANT.ClearProp(appid);
        }