![]() |
CNoFlickerWnd error |
Post Reply
|
| Author | |||
evoX
Senior Member
Joined: 25 July 2007 Status: Offline Points: 207 |
Post Options
Thanks(0)
Quote Reply
Topic: CNoFlickerWnd errorPosted: 27 September 2007 at 1:09pm |
||
|
I have this CNoFlickerWnd class
emplate <class BASE_CLASS>class CNoFlickerWnd : public BASE_CLASS{ protected : virtual LRESULT WindowProc(UINT message,WPARAM wParam,LPARAM lParam){ switch (message){ case WM_PAINT:{ CPaintDC dc( this); // Get the client rect, and paint to a memory device context. // This will help reduce screen flicker. Pass the memory // device context to the default window procedure to do // default painting.CXTPClientRect rc( this);CXTPBufferDC memDC(dc, rc); memDC.FillSolidRect(rc, GetXtremeColor(COLOR_WINDOW)); return BASE_CLASS::DefWindowProc(WM_PAINT,(WPARAM)memDC.m_hDC, 0); } case WM_ERASEBKGND: return TRUE;} return BASE_CLASS::WindowProc(message, wParam, lParam);} }; and I have my class defined like this: class CMyView : public CNoFlickerWnd<CFormView> Why I get this error?Error 202 error C2512: 'CNoFlickerWnd<BASE_CLASS>' : no appropriate default constructor available d:\vs\projects\test\testview.cpp 118
Error 203 error C2614: 'CMyView' : illegal member initialization: 'CFormView' is not a base or member d:\vs\projects\test\testview.cpp 118 |
|||
![]() |
|||
kstowell
Admin Group
Joined: 25 January 2003 Location: MIchigan, USA Status: Offline Points: 496 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 September 2007 at 2:04pm |
||
|
Hi,
This template was not intended to be used as a base class, a correct implementation would be:
If you want to use this as a base class you could probably do it with some minor modifications by adding a constructor, however for what it is worth, it might be just as easy to add "virtual LRESULT WindowProc(UINT message,WPARAM wParam,LPARAM lParam)" to your form view derived class and cut-n-paste the code from the template class, for example:
MyView.h:
MyView.cpp:
Cheers,
|
|||
|
Kirk Stowell, President and CEO
CODEJOCK SOFTWARE SOLUTIONS< |
|||
![]() |
|||
evoX
Senior Member
Joined: 25 July 2007 Status: Offline Points: 207 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 September 2007 at 2:15pm |
||
|
ok, thanks !
|
|||
![]() |
|||
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |