Change icon from default

How can i change the application icon from the default 1.
And how do i add an icon to a dialog form
Thanx
[113 byte] By [newBee2MFC] at [2007-11-19 16:00:50]
# 1 Re: Change icon from default
HICON hMyIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MYICON));
SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);


hwnd is the window handle.You can use GetsafeHwnd function for that.

and IDI_MYICON is the resouce Icon
I think this will help.If so pls rate this.

regards
hariCmenon at 2007-11-10 23:54:50 >
# 2 Re: Change icon from default
Nothing happens
Try something else?

my code -

HICON icon = LoadIcon(NULL, MAKEINTRESOURCE(APP_ICO));
//this->SetIcon(icon, false);
this->SendMessage(WM_SETICON, ICON_BIG, (LPARAM)icon);
newBee2MFC at 2007-11-10 23:55:47 >
# 3 Re: Change icon from default
may be fy form as CDialog can not hold up icon ?
newBee2MFC at 2007-11-10 23:56:46 >
# 4 Re: Change icon from default
Hello,

Change the icon in project resource itself so that you can avoid additional coding. Remember to change icon for both sizes (32x32 & 16x16).

Regards.
Pravin.
Pravin Kumar at 2007-11-10 23:57:51 >
# 5 Re: Change icon from default
How do i do that
I just can not see it
(as i said my form is a dialog form is it a problam ?)
Thanx
newBee2MFC at 2007-11-10 23:58:44 >
# 6 Re: Change icon from default
Hello,

Choose the resource view from the workspace panel, expand and find the icon resource. If it is a dialog resource, there will be only one icon resource and if it is an SDI / MDI application, there will be two (one for the main window and another for the view(s). Double click (each of) the icon(s) and modify as per your requirement. Choose the device views standard (32x32) and small (16x16) from the combobox about the resource edit window to modify both. Compile and see that your icon is what you wanted.

Regards.
Pravin.
Pravin Kumar at 2007-11-10 23:59:54 >
# 7 Re: Change icon from default
This part in CDialog.Ie hi should me a member of Dialog class

HICON hi;

Then

hi =AfxGetApp()->LoadIcon(IDI_ICON3);
SetIcon(hi,0);

hope this will help
hariCmenon at 2007-11-11 0:00:52 >