Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the icon from the executable file only having an instance of it's Process in C#

Tags:

c#

I can get the executable location from the process, how do I get the icon from file?

Maybe use windows api LoadIcon(). I wonder if there is .NET way...

like image 696
Haim Bender Avatar asked Oct 15 '08 01:10

Haim Bender


People also ask

How do you extract an icon from an EXE?

Right-click the EXE file for the software you want to extract an icon from and select Properties. Click the Icons tab shown directly below. Select an icon to extract there.

Where do I find the EXE icon?

Otherwise, you can usually find an application's EXE file in sub-folders of C:\Program Files or C:\Program Files (x86) . When you've found the application's EXE file, right-click it and select “Properties.” In the Properties window, click the “Icons” tab.

How do I add an icon to EXE in PyInstaller?

To change the icon that the .exe has, you can pass the --icon=icon. ico to the pyi-makespec command or modify the . spec file yourself by altering the exe object to add the argument icon='icon.

What is executable file in C?

An executable file (EXE file) is a computer file that contains an encoded sequence of instructions that the system can execute directly when the user clicks the file icon. Executable files commonly have an EXE file extension, but there are hundreds of other executable file formats.


1 Answers

Icon ico = Icon.ExtractAssociatedIcon(theProcess.MainModule.FileName); 
like image 119
TheSoftwareJedi Avatar answered Sep 21 '22 05:09

TheSoftwareJedi