snailophone
Programmer
I am trying to write a simle program in MFC (MSVC++ 2003 .NET) that prints a rectangle to the dialog box. Thats all. I created a class to do this:
//------rectangle class definition---------------
class DrawRectangle : public CDialog
{
private:
CRect rect;
CClientDC *pDC;
CPoint A, B, C, D;
public:
void DrawRect();
};
//--------------------end class def.------------
And here is the DrawRect() function:
//-------------start function def.---------------
void DrawRectangle
rawRect()
{
GetClientRect(&rect);
pDC = new CClientDC(this);
pDC->Rectangle(0, 0, 100, 100);
delete pDC;
}
//----------------end function def-------------
And here is the call to DrawRect():
//-----------------start call------------------
DrawRectangle *wawa = new DrawRectangle;
wawa->DrawRect();
//--------------------end call----------------
I get a "Debug Assertation Failed" error when I click the button I made that calls DrawRect(). Any ideas? Thanks.
//------rectangle class definition---------------
class DrawRectangle : public CDialog
{
private:
CRect rect;
CClientDC *pDC;
CPoint A, B, C, D;
public:
void DrawRect();
};
//--------------------end class def.------------
And here is the DrawRect() function:
//-------------start function def.---------------
void DrawRectangle
{
GetClientRect(&rect);
pDC = new CClientDC(this);
pDC->Rectangle(0, 0, 100, 100);
delete pDC;
}
//----------------end function def-------------
And here is the call to DrawRect():
//-----------------start call------------------
DrawRectangle *wawa = new DrawRectangle;
wawa->DrawRect();
//--------------------end call----------------
I get a "Debug Assertation Failed" error when I click the button I made that calls DrawRect(). Any ideas? Thanks.