Re: Windows 10 Taskbar Behavior

Rob Davenport <[email protected]>
Newsgroups gmane.emacs.windows
Message-ID <AMSPR06MB15250BA9427031DD66CC061CC3A0@AMSPR06MB152.eurprd06.prod.outlook.com>
Just taking a quick stab at it, I'd start changing addpm.c like so:

303a304,309
> 
> 	      wchar_t GNUEmacsAppIDstring[10];
> 	      const PROPERTYKEY DECLSPEC_SELECTANY PKEY_AppUserModel_ID =
>  	  	     { { 0x9F4C2855, 0x9F79, 0x4B39,
> 	  	     { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, } }, 5 };
> 
307a314,335
> 
> 	      // get the shortcut's propertystore interface
> 	      IPropertyStore *store;
> 	      result = IShellLinkA_QueryInterface (shortcut, &IID_IPropertyStore,
> 	                                           (void **) &store);
> 	      // todo: check result, handle errors
> 
> 	      // get the current app id, if any
> 	      PROPVARIANT pv;
> 	      result = store->GetValue(PKEY_AppUserModule_ID, &pv);
> 	      // todo: check result, handle errors
> 
> 	      // set it to "GNU.Emacs"
> 	      wcscpy(GNUEmacsAppIDstring, L"GNU.Emacs");
> 	      pv.vt = VT_LPWSTR;
> 	      pv.pwszVal = GNUEmacsAppIDstring;
> 	      result = store->SetValue(PKEY_AppUserModule_ID, pv);
> 	      // todo: check result, handle errors
> 	      // if successful,
> 	      IPropertyStore_Release(store); //? 
> 	      
> 	      // save the shortcut file
334a363,368
> 
> 	      wchar_t GNUEmacsAppIDstring[10];
> 	      const PROPERTYKEY DECLSPEC_SELECTANY PKEY_AppUserModel_ID =
>  	  	     { { 0x9F4C2855, 0x9F79, 0x4B39,
> 	  	     { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, } }, 5 };
> 	      
338a373,394
> 
> 	      // get the shortcut's propertystore interface
> 	      IPropertyStore *store;
> 	      result = IShellLinkA_QueryInterface (shortcut, &IID_IPropertyStore,
> 	                                           (void **) &store);
> 	      // todo: check result, handle errors
> 
> 	      // get the current app id, if any
> 	      PROPVARIANT pv;
> 	      result = store->GetValue(PKEY_AppUserModule_ID, &pv);
> 	      // todo: check result, handle errors
> 
> 	      // set it to "GNU.Emacs"
> 	      wcscpy(GNUEmacsAppIDstring, L"GNU.Emacs");
> 	      pv.vt = VT_LPWSTR;
> 	      pv.pwszVal = GNUEmacsAppIDstring;
> 	      result = store->SetValue(PKEY_AppUserModule_ID, pv);
> 	      // todo: check result, handle errors
> 	      // if successful,
> 	      IPropertyStore_Release(store); //? 
> 	      
> 	      // save the shortcut file


I don't have mingw setup to compile or test it yet.  And there's more to do (proper return value checking and error handling), and my C may be rusty, but that's the gist of it.


Rob


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Eli Zaretskii
Sent: Monday, October 19, 2015 11:07 AM
To: Juanma Barranquero <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [h-e-w] Windows 10 Taskbar Behavior

> From: Juanma Barranquero <[email protected]>
> Date: Mon, 19 Oct 2015 16:24:35 +0200
> Cc: Rob Davenport <[email protected]>, 
> 	"[email protected]" <[email protected]>, Ben Key 
> <[email protected]>
> 
> On Mon, Oct 19, 2015 at 6:46 AM, Eli Zaretskii <[email protected]> wrote:
> >
> > > From: Rob Davenport <[email protected]>
> > > Date: Mon, 19 Oct 2015 00:10:34 +0000
> > >
> > > Addpm could be modified to add the app id when it creates the 
> > > shortcut, and eliminate step 2.
> >
> > Do you know how to do that from a C program? I didn't find a way, 
> > but I'm not an expert on that stuff.
> 
> The (BSD-licensed) code for Win7AppId is accessible from here:
> 
> https://code.google.com/p/win7appid/

Thanks.  This is C++, whereas I meant C.  The relevant COM interfaces are all defined in C++, so it's a small wonder it should be possible to do in C++.

It doesn't even compile with g++, at least not with mingw.org's headers.  Maybe MinGW64's g++ will succeed, I don't know.

I will try to convert this into C, if no one beats me to it, and see if it's possible.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.