IHateMyJob2004
Lifer
What am I doing wrong? it compiles but I get an exception when I try to run. The exception is as follows:
Debug assertation failed
File: afwwin1.inl
Line: 21
When I run the app in debug mode, it sems like the call to:
this->CreateEx(0, WC_STATIC, 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0);
is what is causing the exception.
The code is as follows:
------------- header file (Foo.h):
#include <afxmt.h>
#include <afxwin.h>
class Foo : public CWnd
{
public:
Foo();
afx_msg void OnTimer(UINT nIDEvent);
DECLARE_MESSAGE_MAP()
};
------------- cpp file (Foo.cpp)
#include "Foo.h"
BEGIN_MESSAGE_MAP(Foo, CWnd)
//{{AFX_MSG_MAP(Foo)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP( )
Foo::Foo() {
// used 'this->' to make sure that the CWnd method is called and not the C funtion
this->CreateEx(0, WC_STATIC, 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0);
timerID = SetTimer(1, 500, NULL);
}
void Foo:: OnTimer(UINT nIDEvent)
{
// <code here>
;
CWnd:: OnTimer(nIDEvent);
}
Debug assertation failed
File: afwwin1.inl
Line: 21
When I run the app in debug mode, it sems like the call to:
this->CreateEx(0, WC_STATIC, 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0);
is what is causing the exception.
The code is as follows:
------------- header file (Foo.h):
#include <afxmt.h>
#include <afxwin.h>
class Foo : public CWnd
{
public:
Foo();
afx_msg void OnTimer(UINT nIDEvent);
DECLARE_MESSAGE_MAP()
};
------------- cpp file (Foo.cpp)
#include "Foo.h"
BEGIN_MESSAGE_MAP(Foo, CWnd)
//{{AFX_MSG_MAP(Foo)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP( )
Foo::Foo() {
// used 'this->' to make sure that the CWnd method is called and not the C funtion
this->CreateEx(0, WC_STATIC, 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0);
timerID = SetTimer(1, 500, NULL);
}
void Foo:: OnTimer(UINT nIDEvent)
{
// <code here>
;
CWnd:: OnTimer(nIDEvent);
}