brenordv/nightscout-companion-apps

App works depending on physical location

brenordv opened this issue · 2 comments

Depending on where you place the application in your hard drive, the app will open, but with that generic Windows application icon. If you see the generic icon, please, move the app to another (more public) folder and try again.

My first hypothesis is that I need to sign the executable.
I also don't know if this will happen with every machine.

Check this section of the readme to see icon examples: https://github.com/brenordv/nightscout-companion-apps#known-issues

Update:
Seems like this has to do with the way Windows caches application Icons.
If I create a shortcut to this app, the Icon in the Taskbar will not be changed, no matter what I do:

  1. Forcing form repaint (Application.DoEvents);
  2. Calling Refresh method from the Main form;
  3. Using a Native API call (Shell_NotifyIcon);
  4. Updating the Application User Model Id (AppUserModelID) using another native API call (SetCurrentProcessExplicitAppUserModelID)

When The shortcut is deleted, everything starts to work again.

My next hypothesis is that If I use a launcher, I can get around that. 🤞

Alright. The launcher approach worked. Now to hammer it all together...