obtaining app-icon of another process
-
hello, what i have is a list of all open windows and running processes. i have a hwnd to each window and its processid. all what i need - i thought. my problem is, i want to list all running tasks in a listbox and show each window´s icon in the listbox... but how to get the icon? i used attached the handle to the window with an CWnd and called hIcon = pWnd.GetIcon(true); - after that i detached that handle from the CWnd... but it only work at 2 apps ;o) so: how to get ann icon of another running process/window??? i searched the net all the night and didn´t found any interesting articles... cheers, vertex_x
-
hello, what i have is a list of all open windows and running processes. i have a hwnd to each window and its processid. all what i need - i thought. my problem is, i want to list all running tasks in a listbox and show each window´s icon in the listbox... but how to get the icon? i used attached the handle to the window with an CWnd and called hIcon = pWnd.GetIcon(true); - after that i detached that handle from the CWnd... but it only work at 2 apps ;o) so: how to get ann icon of another running process/window??? i searched the net all the night and didn´t found any interesting articles... cheers, vertex_x
-
AfxGetInstance...()->LoadIcon()
i don't remember exactly the fisrt function name, but it might be something like this...
TOXCCT >>> GEII power
[toxcct][VisualCalc]you ment AfxGetApp()? that works only on your own created process as far as i know... i don´t know a way to do something linke CWnd::AfxGetApp()->... also ::AfxGetApp is no function in the global namespace... thanks 4 reading ;o) cheers, arné
-
you ment AfxGetApp()? that works only on your own created process as far as i know... i don´t know a way to do something linke CWnd::AfxGetApp()->... also ::AfxGetApp is no function in the global namespace... thanks 4 reading ;o) cheers, arné
-
hello, what i have is a list of all open windows and running processes. i have a hwnd to each window and its processid. all what i need - i thought. my problem is, i want to list all running tasks in a listbox and show each window´s icon in the listbox... but how to get the icon? i used attached the handle to the window with an CWnd and called hIcon = pWnd.GetIcon(true); - after that i detached that handle from the CWnd... but it only work at 2 apps ;o) so: how to get ann icon of another running process/window??? i searched the net all the night and didn´t found any interesting articles... cheers, vertex_x
Check out for this api
[ExtractIcon]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta
-
hello, what i have is a list of all open windows and running processes. i have a hwnd to each window and its processid. all what i need - i thought. my problem is, i want to list all running tasks in a listbox and show each window´s icon in the listbox... but how to get the icon? i used attached the handle to the window with an CWnd and called hIcon = pWnd.GetIcon(true); - after that i detached that handle from the CWnd... but it only work at 2 apps ;o) so: how to get ann icon of another running process/window??? i searched the net all the night and didn´t found any interesting articles... cheers, vertex_x
I get nice results by using SendMessage with WM_GETICON. If that is invalid there is always GetClassLong with an index of GCL_HICON. HICON icon; icon = (HICON) ::SendMessage(hwnd, WM_GETICON, ICON_SMALL, 0); icon = (HICON) ::GetClassLong(hwnd, GCL_HICON);
-
I get nice results by using SendMessage with WM_GETICON. If that is invalid there is always GetClassLong with an index of GCL_HICON. HICON icon; icon = (HICON) ::SendMessage(hwnd, WM_GETICON, ICON_SMALL, 0); icon = (HICON) ::GetClassLong(hwnd, GCL_HICON);
thats it! thanks a lot! :o) hIcon = (HICON)::SendMessage(hwnd, WM_GETICON, ICON_BIG, 0); if(hIcon == NULL) hIcon = (HICON)::GetClassLong(hwnd, GCL_HICON); if(hIcon == NULL) hIcon = (HICON)::GetClassLong(::GetParent(hwnd), GCL_HICON); works - no just looking when hIcon is still NULL, if there is a ICON_SMALL :o) cheers and thanx vertex_x
-
thats it! thanks a lot! :o) hIcon = (HICON)::SendMessage(hwnd, WM_GETICON, ICON_BIG, 0); if(hIcon == NULL) hIcon = (HICON)::GetClassLong(hwnd, GCL_HICON); if(hIcon == NULL) hIcon = (HICON)::GetClassLong(::GetParent(hwnd), GCL_HICON); works - no just looking when hIcon is still NULL, if there is a ICON_SMALL :o) cheers and thanx vertex_x