VenkateshArchana
asked on
sdi application
#include<afxwin.h>
#include "resource.h"
class MyDoc :public CDocument
{
public:
MyDoc()
{
}
DECLARE_DYNCREATE(MyDoc)
};
IMPLEMENT_DYNCREATE(MyDoc, CDocument)
class MyWnd : public CFrameWnd
{
public:
MyWnd()
{
}
DECLARE_DYNCREATE(MyWnd)
};
IMPLEMENT_DYNCREATE(MyWnd, CFrameWnd)
class MyView : public CView
{
public:
MyView()
{
}
DECLARE_DYNCREATE(MyView)
};
IMPLEMENT_DYNCREATE(MyView ,CView)
class MyApp : public CWinApp
{
CRuntimeClass *md,*mv,*mf;
public:
BOOL InitInstance()
{
md = RUNTIME_CLASS(MyDoc);
mf= RUNTIME_CLASS(MyWnd);
mv = RUNTIME_CLASS(MyView);
CSingleDocTemplate *sdi = new CSingleDocTemplate(IDR_MEN U1,md,mv,m f);
AddDocTemplate(sdi);
return TRUE;
}
};
MyApp app;
error
Compiling...
SDI.CPP
E:\VC++\SDI Applicaion\SDI.CPP(36) : error C2259: 'MyView' : cannot instantiate abstract class due to following members:
E:\VC++\SDI Applicaion\SDI.CPP(27) : see declaration of 'MyView'
E:\VC++\SDI Applicaion\SDI.CPP(36) : warning C4259: 'void __thiscall CView::OnDraw(class CDC *)' : pure virtual function was not defined
c:\program files\microsoft visual studio\vc98\mfc\include\af xwin.h(359 4) : see declaration of 'OnDraw'
E:\VC++\SDI Applicaion\SDI.CPP(36) : error C2259: 'MyView' : cannot instantiate abstract class due to following members:
E:\VC++\SDI Applicaion\SDI.CPP(27) : see declaration of 'MyView'
E:\VC++\SDI Applicaion\SDI.CPP(36) : warning C4259: 'void __thiscall CView::OnDraw(class CDC *)' : pure virtual function was not defined
c:\program files\microsoft visual studio\vc98\mfc\include\af xwin.h(359 4) : see declaration of 'OnDraw'
Error executing cl.exe.
please help me out
#include "resource.h"
class MyDoc :public CDocument
{
public:
MyDoc()
{
}
DECLARE_DYNCREATE(MyDoc)
};
IMPLEMENT_DYNCREATE(MyDoc,
class MyWnd : public CFrameWnd
{
public:
MyWnd()
{
}
DECLARE_DYNCREATE(MyWnd)
};
IMPLEMENT_DYNCREATE(MyWnd,
class MyView : public CView
{
public:
MyView()
{
}
DECLARE_DYNCREATE(MyView)
};
IMPLEMENT_DYNCREATE(MyView
class MyApp : public CWinApp
{
CRuntimeClass *md,*mv,*mf;
public:
BOOL InitInstance()
{
md = RUNTIME_CLASS(MyDoc);
mf= RUNTIME_CLASS(MyWnd);
mv = RUNTIME_CLASS(MyView);
CSingleDocTemplate *sdi = new CSingleDocTemplate(IDR_MEN
AddDocTemplate(sdi);
return TRUE;
}
};
MyApp app;
error
Compiling...
SDI.CPP
E:\VC++\SDI Applicaion\SDI.CPP(36) : error C2259: 'MyView' : cannot instantiate abstract class due to following members:
E:\VC++\SDI Applicaion\SDI.CPP(27) : see declaration of 'MyView'
E:\VC++\SDI Applicaion\SDI.CPP(36) : warning C4259: 'void __thiscall CView::OnDraw(class CDC *)' : pure virtual function was not defined
c:\program files\microsoft visual studio\vc98\mfc\include\af
E:\VC++\SDI Applicaion\SDI.CPP(36) : error C2259: 'MyView' : cannot instantiate abstract class due to following members:
E:\VC++\SDI Applicaion\SDI.CPP(27) : see declaration of 'MyView'
E:\VC++\SDI Applicaion\SDI.CPP(36) : warning C4259: 'void __thiscall CView::OnDraw(class CDC *)' : pure virtual function was not defined
c:\program files\microsoft visual studio\vc98\mfc\include\af
Error executing cl.exe.
please help me out
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hm - you're welcome - but, why did you decide to rate this answer as 'B'? Was anything missing or unclear or incorrect?
ASKER
i just missed out , surely it was an excellent answer with one line
ASKER
can u explain the difference between between CClientDC and CPaintDC
A CClientDC is a DC which 'addresses' the client area of a window without any extra handling. A CPaintDC is a DC which internally handles calls to 'BeginDraw' and 'EndDraw' GDI functions which are used to draw when a window (or part of it) needs to be updated. So a CPaintDC i.e. is created with a clipping region including only the parts of the window which needs updating, a CClientDC initially has no clipping region.
Addition: due to the above mentioned you usually cannot use CPaintDC outside of a WM_PAINT message handler since only within a WM_PAINT message handler BeginPaint/EndPaint can be used to create a DC. And, further, it's not possible to create more than one CPaintDC while processing a WM_PAINT message ...
ASKER
can u give me an example for the above 2
Well, the usage of both is the same (as with any kind of DC), the only difference is when to use which one - commonly (i.e. with a CView) there's no need to worry about this since the relevant functions get a CDC* passed like CView::OnDraw. A CPaintDC is only needed/used when a WM_PAINT message is to be handled directly, so i.e. if a new kind of control is to be implemented.
Here's a link to a book (at google-boos) with lot's of MFC samples, maybe this can help you: http://books.google.com/books?id=7PsZNxl_5U8C&pg=PA120&lpg=PA120&dq=CPaintDC+sample&source=bl&ots=SYdWrtLJMn&sig=S-4kSnkbSPzeFk7RhPtr8C9AE8E&hl=de&ei=fz3lTPTqJoLusgavgN24Cw&sa=X&oi=book_result&ct=result&resnum=6&ved=0CEYQ6AEwBQ#v=onepage&q&f=false
Here's a link to a book (at google-boos) with lot's of MFC samples, maybe this can help you: http://books.google.com/books?id=7PsZNxl_5U8C&pg=PA120&lpg=PA120&dq=CPaintDC+sample&source=bl&ots=SYdWrtLJMn&sig=S-4kSnkbSPzeFk7RhPtr8C9AE8E&hl=de&ei=fz3lTPTqJoLusgavgN24Cw&sa=X&oi=book_result&ct=result&resnum=6&ved=0CEYQ6AEwBQ#v=onepage&q&f=false
ASKER