开发者

change icon of a dialog

开发者 https://www.devze.com 2023-01-27 05:15 出处:网络
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 use

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消