In Visual C++, if I create a CPaintDC object in a global function (any function other than the OnPaint message-handler), as follows:
void myfunction(CWnd* pWnd)
{
CPaintDC dc(CWnd* pWnd);
CPen newpen;
CPen* oldpen;
newpen.CreatePen(PS_SOLID,1,RGB(0,0,0));
oldpen=dc.SelectObject(&newpen);
dc.TextOut(100,100,"Some text");
dc.SelectObject(oldpen);
newpen.DeleteObject();
return;
}
and then want to create a new CPaintDC object in a DIFFERENT function, do I have to call the CPaintDC destructor at the end of the first function? If so, then HOW do I call it?
Thanks!
void myfunction(CWnd* pWnd)
{
CPaintDC dc(CWnd* pWnd);
CPen newpen;
CPen* oldpen;
newpen.CreatePen(PS_SOLID,1,RGB(0,0,0));
oldpen=dc.SelectObject(&newpen);
dc.TextOut(100,100,"Some text");
dc.SelectObject(oldpen);
newpen.DeleteObject();
return;
}
and then want to create a new CPaintDC object in a DIFFERENT function, do I have to call the CPaintDC destructor at the end of the first function? If so, then HOW do I call it?
Thanks!