Document icon changes after first launch on Windows - windows

I have an application that gets installed with a Wise installer (EDIT: Wise creates a Setup.exe file, not an MSI). Upon installation, an icon is set for a certain file type:
HKEY_CLASSES_ROOT\.auz\DefaultIcon = C:\Path\To\App\some_icon.ico,0
Right after the installation, however, Explorer chooses to display this icon using the generic "white sheet + application icon" icon, which is different (and not provided by me).
Upon first launch, the application itself registers icons and other file associations, so that the last run version "owns" those documents. At that point, Explorer changes the icon for this file type and displays the correct one, but when I look at the registry, the value for DefaultIcon is exactly the same.
This is what I've tried so far
Removing all entries from the registry, and writing them myself.
After the installation, "touching" the value of DefaultIcon, and then launching a small little program that only calls SHChangeNotify(SHCNE_ASSOCCHANGED) (my program does this after updating the file associations in the registry).
After the installation, killing and restarting Explorer.
After the installation, using TweakUI to "repair" the icons on the desktop.
None of these work. The only way to get the correct icon is to let the program itself install it. I can't find any change in the registry. I'm pulling my hair off.
What I would like to avoid
Testing with another installer software
Changing the installation script too much (I don't have Wise itself, as the installer gets built on another machine on demand).
Embed the icons in the executable.
Any suggestions on how to get Explorer to display the correct icon after installation?

A couple of things come to mind:
why do you have the ',0' after the icon in the registry? That would limit the shown icon to one single icon. Better would be to have an icon file which contains several icons (same icon UI but different sizes/color depths) - Explorer has different icon views! Try removing the ',0' if your icon file only has one icon in it.
it may be that the registry is written last in the installer, after the explorer got notified of updates?
make sure the registry entry is written after the icon file is stored on disk
you should use the Wise installers own configuration to register the file type. Not sure, but I think explorer won't take any changes until the whole installation of an msi is finished, so calling SHChangeNotify() manually won't help. The msi has its own table for this, which Wise will add if you use the right configuration.
For Wise, do the following (instead of creating the registry keys on your own):
Under the Feature Details page group, select the File Associations page.
From the Current Feature drop-down list, select Core.
Click Add at the right of the window and select New.
The File Association Details dialog appears.
Click the Extension Details tab.
Browse to the QuickFacts directory, select the file QckFacts.exe, and click OK.
In Extension, enter: qft
Leave the defaults for the rest of the fields and click OK.
The extension .QFT is added to the installation. When an end user double-clicks a
file with this extension on the destination computer, the QuickFacts application
launches.
Save the installation
[Edit]
You may also missing required registry entries (the icon might not be enough for the shell to show it):
HKEY_CLASSES_ROOT\.auz\(default) = auzfile
HKEY_CLASSES_ROOT\.auz\shell\open\command = C:\Path\To\App.exe

Here's the solution.
Each file type (let's say ".auz" in this case) was registered with:
A DefaultIcon key with the path to the icon resource, and
A value for the HKEY_CLASSES_ROOT\.auz\(default) value giving a description of the file type, e.g. "Foobar Document".
In addition to this, there was an entry for the "Foobar Document" document type, or more specifically, a key for how to open such documents from the shell:
HKEY_CLASSES_ROOT\Foobar Document\Shell\command\open\(default) = C:\Path\To\App.exe "%1"
Apparently, this key supersedes the value written for the specific file extension. Because the icons are external to the .exe file, Windows Explorer then used the first icon of the application to create an icon for all files of type "Foobar Document" (that "white sheet + application icon" icon I mentioned).
Now, what I had wrong was that the application itself does change the value of
HKEY_CLASSES_ROOT\.auz\(default)
to a slightly different value when starting, say "Foobar 1.2 Document" (the problem with not being DRY). Thus, the link to "Foobar Document" was lost, and the .auz files got their icons after the first launch.
So I fixed this all by simply removing the HKEY_CLASSES_ROOT\Foobar Document key altogether, and voilà!

Related

Jams Scheduler Client 7.1.478.0- Shortcut bar has disappeared

The title says it all. I use Jams Scheduler on a daily basis. The Shortcut menu, which is a default feature of the program and gives me access to job history and monitoring, is simply not on the front page when I open the program. I have tried altering font size and scaling options on Windows 10. The jams scheduler guide doesn't offer any help since every direction they have starts with "go to the shortcut bar". Please see the highlighted portion of the screenshot to see the portion that is missing. Has anyone run into this problem before?
JAMS has an option to make the Shortcuts panel float in a separate window by right-clicking on the Shortcuts panel title bar and selecting Float, or by dragging the shortcuts title bar out of the JAMS window. My guess is that your Shortcuts window is floating off screen.
You can restore your JAMS client back to defaults by deleting the version subfolder underneath your user's AppData Local folder for JAMS. By default, this folder is under C:\Users{username}\AppData\Local\HelpSystems\JAMS. Delete the 7.1.478.0 folder and the next time you open JAMS it will treat you as a new user with default views and a restored Shortcuts bar. This means you'll need to re-enter your server name, so if you don't remember it, make sure before you delete the folder you hit the gears icon and select "Servers..." to see your server name.

disable items showing up in windows 10 timeline

I have a win32 text editor app. Every file that opens in it is automatically added to the Windows 10 timeline. The problem is that these entries in the timeline are useless because they don't actually work (i.e., you can't click on them to re-open the file in my editor), and instead of the editor app name the timeline shows the AppUserModelID instead.
Is there an API that I can call to prevent Windows from adding the files opened in my editor to the timeline? Or maybe an entry in the apps manifest?
Note that I'm setting the AppUserModelID to control the Jumplist feature, which I'd like to keep. I just don't want the files to show up in the timeline.
Also it seems that only files added to the recent docs with SHAddToRecentDocs show up.
Or maybe there's a way to get the entries in the timeline to work properly (i.e., when clicked open them in my editor, and have the app name show up properly).
update:

How to force folder refresh in Sublime, when "Project > refresh" doesn't work?

Especially when using an sftp drive (but this problem is also an issue with local drives, although thankfully not as frequent), the folders in the sidebar just keep spinning and spinning, and the "Open Anything" dialog therefore has no files to choose from.
"Project > Refresh folders" does not work in most cases.
I've resorted to restarting Sublime manually, which works most of the time, but it's getting to be a pain to have to do this every other time I switch projects.
Is there any better way to "force" the folders to refresh?
This problem is the reason I asked this question:
How to save project state before exiting in ST3 on Windows?
The SublimeRestart plugin doesn't work on Windows until this project-state-saving problem is solved. However, even if it did work perfectly, it would still only be a workaround for this really annoying non-refreshing-folders issue.
My workaround on Windows, FYI: After loading a project, when the folders don't refresh (don't load even the first time), I have ctrl+f10 bound to "File > Exit", and f10 configured into the shortcut that I launch Sublime Text with. So two reasonably-quick (although additional!) button presses.
Open Sublime Text.
Select Preferences from the top menu and click Key Bindings – User. Here you will see a JSON file that should contain an array of objects (initially the array is empty). Every object will represent a shortcut.
Add the following (new shortcut object) entry into the array (between the brackets):
{
"keys" : ["f5"],
"command" : "refresh_folder_list"
}
You should be able to refresh the folders with F5.
Try to Install this package:
https://packagecontrol.io/packages/SideBarEnhancements
Open the package folder. Main menu -> Preferences -> Package Control: -> Package Control: Install Package
Search the keyword: Side​Bar​Enhancements
Enjoy it
After you install this plugin, you will see the refresh button in your sidebar option:
I have added this myself the other day. I constantly work in an environment where files in the project are changing before I can see them.
Goto 'Preferences' menu -> 'Key Bindings' -> 'User' which will open a JSON file, add below code, save and close that file.
{ "keys": ["ctrl+f5"], "command": "refresh_folder_list" }
It will work like charm 100%. Thanks for asking this question.
This isn't going to be a very useful answer but it documents some early behaviour in Sublime Text that would solve your problem, assuming you need no later features from Sublime Text 2/3 (a big assumption indeed).
Sublime Text 1 had the handy feature in the folder context menu to "Refresh folder". This cause an immediate indexing of only the specified directory (and subdirectories) which was a boon when using networked drives over high-latency connections.
This was deprecated in Sublime Text 2.
Version 1 is available here or by direct download here. It's not clear that these will be available indefinitely though, so this isn't necessarily a long-term solution.

Change Icon Index of shortcut during installation

I'm working with InstallShield 2013 Professional, Basic MSI Project.
My installation package contains exe file - myfile.exe. I added shortcut for it in Shortcuts view specifying myfile.exe as Icon File, and 0 as Icon Index. The destination place for this shortcut is a Desktop on a target box.
Suppose, my executable contains 3 icon resources and I want to change icon dynamically during Installation. To be more clear what I want to do: I have 3 radio buttons on one of Installation Dialogs and I want to apply icon to myfile.exe shortcut depending on radio button that was checked (1-st radio button->1-st icon, 2-nd radio button->2-nd icon, 3-rd radio button->3-rd icon).
How can I get this behavior? In other words, how can I change icon index of Icon File during installation?
This is kind of a complicated request. An easier way of achieving this would be to compile the EXE three times with different names and different icon 0 resources and then use mutually exclusive component conditions to control which one gets installed.
It gets trickier if that's not an option. The Shortcut Table defines the IconIndex column as an integer and is not formattable. This means you can't say [ICONINDEX] in the field and let it resolve at install time.
So what can you do? You can use a custom action to dynamically emit table data into temp tables during the install. An example using C# can be found here at: Dynamic Windows Installer UI
Realize that if someone creates a shortcut by hand they are likely to pick the "wrong" icon.

Why does the icon for my project look so horrible in Windows 7?

I have an old VB6 project that I updated for Windows 7, including icons with 48x48 size. When I run it, the icon in the task bar appears washed out.
I think I have all the necessary icon sizes in the .ico file, but maybe I am missing something:
What am I missing here?
VB6 only supports 16 color icons which will cause dithering and, consequently, the transparency information is limited to a single bit indicating whether a pixel is transparent or not.
As always, you can rely on a set of Windows' APIs to overcome this limitation.
Here's a link to a forum post explaining how to use 256 color icons: VB6 System Tray Icon Color Depth
I found a vbaccelerator article from the XP days that seems to work in Windows 7 as well. The key is to follow the instructions to the letter. And it only works in a compiled app, not in the IDE. Finally, when you add a 256x256 image to your icon, make sure that it's not PNG compressed when the icon is saved (most editors have a preference for that hidden away somewhere).
The solution is very simple:
Enable visual styles; add manifest to your application and the VB IDE.
Adding manifest to the VB IDE is a bit tricky in Vista and above. Follow instructions here:
http://vbnet.mvps.org/index.html?code/forms/vbidevista.htm
Then, to add the manifest to your application.
This will also enable you to make your application start as elevated (Have Admin access when started):
Step 1: Create your manifest text-file.
There are 2 options: The normal manifest-file, and a manifest-file for requiring Admin-privileges.
Manifest File:
(Download link at the end)
Manifest Admin File:
(Download link at the end)
Once you have created your manifest-file, add it to your project:
Open the Resource Editor, and click "Add Custom Resource..." (The button next to the question-mark).
Select your manifest-file and add it to the editor.
Now, double-click on the newly added resource, to edit it's properties.
Set these values:
Type: #24
ID: 1
Now, here is the last and most important step:
Set your project to start with Sub Main.
In Sub Main, as one of the first things, you call the function InitCommonControls.
This HAS TO BE CALLED before any Forms, Controls or other Dialogs are loaded!
InitCommonControls:
(Download link at the end)
That's it!
Your VB6 is not fully up to date and using visual styles.
Download link, as promised:
https://www.dropbox.com/sh/neyueoozv87k1qd/AACbID8_aC718LCjs12T16Oqa?dl=0

Resources