用MFC做一个膨胀的椭圆时出现了错误
在用MFC写一个膨胀的椭圆的绘图程序时,出现了一个致命的错误,错误如下用红字标示的地方#include<afxwin.h>
#include<afxext.h>
#define SeedRand() srand(UINT)::GetTickCount()
class CMyApp:public CWinApp{
public:
virtual BOOL InitInstance();
};
class CMainWnd:public CFrameWnd{
protected:
int m_nCurScreen;
CPoint rec_E;
int R_rec;
int L_rec;
COLORREF GetRandomColor();
UINT MapRand(UINT nMax);
void Growing_Ellipse(CClientDC *pDC);
public:
CMainWnd();
afx_msg void OnTimer(UINT IDtimer);
DECLARE_MESSAGE_MAP();
};
#include "CDCDEMO.h" //在这一行出现了错误,说是运行时出现了致命的错误,说这个库函数找不到,请问这个库文件是原来就有的还是要自己定义??再请问这个库函数包含些什么样的函数???请高手们指教啊!!!!
BEGIN_MESSAGE_MAP(CMainWnd,CFrameWnd)
ON_WM_TIMER()
END_MESSAGE_MAP()
CMainWnd::CMainWnd(){
rec_E.x=320;
rec_E.y=480;
R_rec=30;
L_rec=10;
SeedRand();
}
COLORREF CMainWnd::GetRandomColor(){
return RGB(MapRand(255),MapRand(255),MapRand(255));
}
UINT CMainWnd::MapRand(UINT nMax){
int nRand=rand();
float fMap=(float)nMax/RAND_MAX;
float fRetVal=(float)nRand*fMap+0.5F;
return (UINT)fRetVal;
}
void CMainWnd::OnTimer(UINT IDtimer){
CClientDC dc(this);
Growing_Ellipse(&dc);
}
void CMainWnd::Growing_Ellipse(CClientDC *pDC){
CBrush ColorBrush(GetRandomColor());
pDC->SelectObject(&ColorBrush);
pDC->Ellipse(rec_E.x-R_rec,rec_E.y-R_rec*480/640,
rec_E.x+R_rec,rec_E.y+R_rec*480/640);
R_rec=R_rec+C_rec;
if(rec_E-R_rec<=10||rec_E-R_rec>=300) C_rec-=C_rec;
}
BOOL CMyApp::InitInstance(){
CMainWnd *pFrame=new CMainWnd;
pFrame->Create(0,"Graphics Demo",WS_POPUPWINDOW|WS_DLGFRAME,CRect(0,0,640,480));
this->m_pMainWnd=pFrame;
pFrame->ShowWindow(m_nCmdShow);
pFrame->UpdateWindow();
pFrame->SetTimer(0,50,NULL);
return TRUE;
}
CMyApp MyApp;