change icon of a dialog
i am recently editing an open source project in visual c++ 2010 , i don't know much about v开发者_Go百科c++ ,(i have only 5 days of experience in c++), with my little knowledge i am changing some user interface of the project
there is only one icon in my project ,the apps shows the main icon as icon , at the same time i want to make that icon to be on the title of a dialog also (the dialog will be shown when a button in main form is clicked),
the dialog is already in the resources/dialogs but i want to change the icon of it ;
You need to find the dialog procedure of the dialog you're interested in, and in the WM_INITDIALOG
message handler (you need to add it if it's not already present) use WM_SETICON
to set the icon:
// hIcon is your icon handle
SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
精彩评论