c++ - Get icon process from HWND, process name OR other process identifier -


i have process name , handle (hwnd) of window.
i want relative icon (if available).
searching through msdn, found extracticon() handle icon given exe name, , geticoninfo() "information" of icon hicon.
i don't know if it's right way this, , how retrieve correct information show (in second moment) icon without handle icon.
i have send information process (through socket) has show icon.

in iconinfo structure there hbitmap fields contains bitmap (black&white , colour). useful?

you can use api getclasslong retrieve icon associated program use sendmessage api passing hwnd of of window want change it's icon.

in example extracted icon application set calculator. windows calculator open before sending icon:

case wm_lbuttondown: // explanation left clicking in client area , see result {     hicon icon = (hicon)getclasslong(hwnd, gcl_hicon);     hwnd hcons = findwindow(null, "calculator"); // opened windows calculator. can use other window sure valid handle     if(!hcons)         messagebox(0, "\"calculator\" windows not found!", 0, mb_ok|mb_iconhand);     sendmessage(hcons, wm_seticon, (wparam)icon_big, (lparam)icon); // setting icon  } break; 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -