关于程序的图标问题
只是程序的图标改了,窗口和状态栏的图标都没有改
// minMFC.cpp : Defines the entry point for the application.
//
#include <afxwin.h>
#include "resource.h"
class CMinApp:public CWinApp //定义应用程序类
{
public:
virtual BOOL InitInstance(); //重载应用程序初始化函数
};
class CMainWnd:public CFrameWnd
{
protected:
HICON m_hIcon;
BOOL PreCreateWindow(CREATESTRUCT& cs);
int CMainWnd::OnCreate(LPCREATESTRUCT lpCreateStruct);
// afx_msg void OnLButtonDown(UINT nFlags,CPoint point);
afx_msg void OnRButtonDown(UINT nFlags,CPoint point);
afx_msg void OnLButtonDblClk(UINT nFlags,CPoint point);
DECLARE_MESSAGE_MAP();
};
BEGIN_MESSAGE_MAP(CMainWnd,CFrameWnd)
//ON_WM_LBUTTONDOWN()
ON_WM_RBUTTONDOWN()
ON_WM_LBUTTONDBLCLK()
END_MESSAGE_MAP()
/*void CMainWnd::OnLButtonDown(UINT nFlags,CPoint point)
{
CString szAboutLeft="copyLEFT";
::MessageBeep(MB_ICONINFORMATION);
::MessageBox(GetSafeHwnd(),szAboutLeft,"About",MB_OK|MB_ICONINFORMATION);
CFrameWnd::OnLButtonDown(nFlags,point);
}*/
BOOL CMainWnd::PreCreateWindow(CREATESTRUCT& cs)
{
m_hIcon=::LoadIcon(AfxGetApp()->m_hInstance,MAKEINTRESOURCE(IDI_ICON1));
return CFrameWnd::PreCreateWindow(cs);
}
int CMainWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if(m_hIcon)
{
SetIcon(m_hIcon,TRUE);
SetIcon(m_hIcon,FALSE);
}
return 0;
}
void CMainWnd::OnRButtonDown(UINT nFlags,CPoint point)
{
CString szAboutRight="copyRIGHT";
::MessageBeep(MB_ICONINFORMATION);
::MessageBox(GetSafeHwnd(),szAboutRight,"About",MB_OK|MB_ICONINFORMATION);
CFrameWnd::OnLButtonDown(nFlags,point);
}
void CMainWnd::OnLButtonDblClk(UINT nFlags,CPoint point)
{
/*CString szAboutDB="hello vc";
::MessageBeep(MB_ICONINFORMATION);
::MessageBox(GetSafeHwnd(),szAboutDB,"About",MB_OK|MB_ICONINFORMATION);*/
GetDC()->TextOut(1,1,"Hello");//CDC最简单的用法(用于输出文字)
GetDC()->TextOut(1,100,"Crab");
CFrameWnd::OnLButtonDblClk(nFlags,point);
}
BOOL CMinApp::InitInstance() //应用程序初始化
{
CFrameWnd* pFrame = new CMainWnd; //动态生成主窗口类对象
pFrame->Create(0,_T("消息以及CDC类的使用")); //创建主窗口
pFrame->ShowWindow(SW_SHOWMAXIMIZED); //显示主窗口
pFrame->UpdateWindow(); //刷新主窗口
AfxGetApp()->m_pMainWnd=pFrame; //指定应用程序主窗口
return TRUE;
}
CMinApp MyApp; //生成应用程序对象并执行应用程序