HICON hicon;
hicon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MYICON));
SetIcon(hicon, true );
dont forget to add the new icon
IDR_MYICON via resource.
if it is a dialog based MFC application do it in your OnInitDialog()
if SDI application do it in your CMainFrame::OnCreate() function