Getting the icon associated with a running application using WinAPI
2 answers
Once you have a handle to the window, you can use GetClassLong :
HICON icon = (HICON)GetClassLong(window, GCL_HICON);
+2
source to share
You have a hwnd, you can get the process id using WINAPI GetWindowThreadProcessId. With this, you can create a C # Process object. Then you can iterate through the ProcessModule Collection process to get the name of the executable. Finally, you can use the WINAPI function ExtractIconEx to get the icon from the path
Pinvoke has information on two WINAPI methods
http://www.pinvoke.net/default.aspx/user32/GetWindowThreadProcessId.html
http://www.pinvoke.net/default.aspx/shell32/ExtractIconEx.html
0
source to share