tags:

views:

181

answers:

2

Having the window handle for an open application, I'm able to use the GetWindowText function to retrieve the text from the title bar of the app. I would like to take this a step farther and retrieve the icon associated with the same app.

How might I go about doing this? I looked through what I thought would be the relevant Win32 API sections, but nothing jumped out at me.

Any pointers would be appreciated.

Thanks in advance!

+4  A: 
Icon ico = Icon.ExtractAssociatedIcon(theProcess.MainModule.FileName);

From TheSoftwareJedi

Initially this appears to be an exact duplicate of http://stackoverflow.com/questions/203456/how-can-i-get-the-icon-from-the-executable-file-only-having-an-instance-of-its but that one seems to focus largely on how to get it from within it's own self, whereas you may be asking how to get the icon using a program separate from the running process.

Adam Davis
A: 

It's a Win32 FAQ See news://194.177.96.26/comp.os.ms-windows.programmer.win32