Default icon for .exe file regardless of Windows version - windows

I show a bunch of exe files in a listview, and I want to show their default icon, but if the exe file has no icon resource, I would like to show the Windows default application icon regardless of the OS version. If I check the registries at:
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\exefile\DefaultIcon]
the default value is "%1", which is the first icon in the exe file itself. But where is the default .exe icon for exe files with no icon?

This is what XP does (this is actually a shortcut, but you get the point)
It's been awhile; but doesn't shell32 handle this?
Here's an older article from stackoverflow

Related

How to detect whether a file is an executable file in Windows?

Is it correct to assume that executable files do not show an "Open-With" submenu in the Windows right-click File Explorer context menu?
Is there a Winapi function to detect whether a file is an EXECUTABLE FILE?
(I need to detect this to get the information on whether a file can show an "Open-With" submenu in the Windows right-click File Explorer context menu).
The fact that executable files do not show an "Open-With" submenu does not mean that files do not show an "Open-With" submenu are executable files.
If you want to detect whether a file is an EXECUTABLE FILE. I suggest you could try to use GetBinaryTypeA function

How can I save custom icons for shortcuts

I have a shortcut with a custom icon on it, the icon shows fine until I try copy the shortcut to another machine.
I have the icon saved in the same folder as the shortcut yet it still does not show when copied to another machine.
I was wondering if there was a way to have this icon stored inside the shortcut or some way to have it get the icon from the current folder with a relative path?
Icons cannot be stored inside a .lnk file and you cannot use a relative path to the icon.
The only thing you can use are environment variables (the .lnk will have a EXP_SZ_ICON_SIG data block).

Application icon becomes blank when folder is changed

I have created an MFC application which has the icon for it as part of its resources. Now, when I place the shortcut to the application on Desktop the icon for the application appears as expected. But now when I create a folder and move this shortcut inside that folder; it becomes blank.
I am facing another situation as well; where the exe kept inside the output folder doesn't show the icon and is blank. But as soon as I change the name of the exe both the icon in the output folder aswell the desktop icon for it appears.
I am using Windows 10 and application is built using VS2008. Could you please help?

How to change a file's extension to something else?

I downloaded an .R file from a zoom chat on desktop to open in Rstudio later.
Well, the .R extension was not part of the name, so I changed the name to something.pdf (of course by mistake).
The icon now looks like a pdf. I replaced the .pdf with .R. But the icon still is a PDF file and Rstudio does not recognize it as an R file.
How can I can change it back to its .R format?
edit. thanks for pointing this out. I am on a windows 10 machine. and the file is on desktop.
Troubleshoot for Windows
You may be trying to add multiple file extensions, which does not allow the file to be ready correctly.
A quick google search.
How do I reveal file extensions?
For Windows 8-10
Start Windows Explorer, you can do this by opening up any folder.
Click the View menu.
Check the box next to "File name Extensions"
Then make sure you have my_file.R as opposed to my_file.R.R.pdf.

Processing - Change default application icon

How to change the default icon of my Processing appIconTest.exe exported
application in windows ?
The default one :
After some research, the easiest solution i could find is :
Go into ...\processing-3.0.1-windows64\processing-3.0.1\modes\java\application
Save sketch.ico somewhere you can find (renaming it will help).
Place the icon you want to use in the same folder with the same name sketch.ico (which you might create using GIMP).
Now you can export your application from Processing.
Important : Be sure to save the default icon, because every application you export (after changing the icon) using Processing, will have this new icon.
You can change the icon of your running application (the icon that shows up in the title bar of the window and the task bar), but I don't think that's what you're asking about. You can't easily change the icon of the file itself.
That icon seems to be coming from the core.jar Processing library file, so if you want to hack at it, you could try replacing that file in the jar. I really don't recommend that though.
Because the .exe file that Processing exports isn't really an executable anyway- it's really just a shell that calls the code in the lib directory. (source)
If you want to create a real .exe file and have control over its icon, you should look into using a .exe generator like JSmooth or launch4j or JWrapper.
I would recommend Resource Hacker to change the icon of your programs.
Install Resource Hacker (latest build).
Go to your executable file.
Open it with Resource Hacker (right mouseclick, and there should be an option to do that or else you could just click open with).
It will open and show some directories, also one called "Icon", open that one, and right click one one of the icon files (stars with some numbers after that), there will be an option: "replace icon ... Ctrl + R", click that one and replace your icon.

Resources