代码改变世界

Change ICON of MFC Application and Dialog

2014-04-29 22:53  hongjiumu  阅读(866)  评论(3编辑  收藏  举报

Change ICON of MFC Application and Dialog
http://www.codeproject.com/Tips/406870/Change-ICON-of-MFC-Application-and-Dialog

#include "FirstApp.h"
#include "resource.h"
 
CFirstWnd::CFirstWnd()
{
    Create(
        NULL,
        "My First Application",
        WS_OVERLAPPEDWINDOW
        );
}
 
BOOL CFirstApp::InitInstance()
{
     
    m_pMainWnd=new CFirstWnd();
    HICON hIcon=::LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(AFX_ID_STD_FRAME));
    m_pMainWnd->SetIcon(hIcon,FALSE);
    m_pMainWnd->ShowWindow(m_nCmdShow);
    m_pMainWnd->UpdateWindow();
    return true;
}
 
CFirstApp firstApp;