hi,
Needed some inputs regarding the function signatures for User Defined Message Handlers. Was trying to resolve a Random Invalid page fault in Release Mode exe, that's causing my Application to crash.
According to comments gathered from similar questions here, the correct signature for ON_MESSAGE() is
afx_msg LRESULT OnMyMsg(WPARAM,LPARAM). However my message handler function is not returning anything, hence am using afx_msg void. Would that matter ?
Also can anyone tell me why exactly my function signature for the message handler has to be outside the AppWizard generated message handler segment.
Have attached a sample code snippet below. Does anyone see anything that could lead to a mfc42.dll page fault, therein.
Thanx,
Deep.
/*MyMacros.h*/
#define WM_USER_UPDATE_STATUS_LOG (WM_USER + 52)
/*ChildFrm.h*/
class CChildFrame : public CMDIChildWnd
{
DECLARE_DYNCREATE(CChildFrame)
public:
CChildFrame();
// Generated message map functions
protected:
//{{AFX_MSG(CChildFrame)
afx_msg int OnCreate(LPCREATESTRUCT
lpCreateStruct);
afx_msg void OnDestroy();
//}}AFX_MSG
afx_msg void OnSmsStatusLog(WPARAM, LPARAM);
DECLARE_MESSAGE_MAP()
};
/*ChildFrm.cpp*/
// CChildFrame
IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
//{{AFX_MSG_MAP(CChildFrame)
ON_WM_CREATE()
ON_WM_DESTROY()
//}}AFX_MSG_MAP
ON_MESSAGE (WM_USER_UPDATE_STATUS_LOG,OnSmsStatusLog)
END_MESSAGE_MAP()
///////////////////////////////////////////////////////////
Needed some inputs regarding the function signatures for User Defined Message Handlers. Was trying to resolve a Random Invalid page fault in Release Mode exe, that's causing my Application to crash.
According to comments gathered from similar questions here, the correct signature for ON_MESSAGE() is
afx_msg LRESULT OnMyMsg(WPARAM,LPARAM). However my message handler function is not returning anything, hence am using afx_msg void. Would that matter ?
Also can anyone tell me why exactly my function signature for the message handler has to be outside the AppWizard generated message handler segment.
Have attached a sample code snippet below. Does anyone see anything that could lead to a mfc42.dll page fault, therein.
Thanx,
Deep.
/*MyMacros.h*/
#define WM_USER_UPDATE_STATUS_LOG (WM_USER + 52)
/*ChildFrm.h*/
class CChildFrame : public CMDIChildWnd
{
DECLARE_DYNCREATE(CChildFrame)
public:
CChildFrame();
// Generated message map functions
protected:
//{{AFX_MSG(CChildFrame)
afx_msg int OnCreate(LPCREATESTRUCT
lpCreateStruct);
afx_msg void OnDestroy();
//}}AFX_MSG
afx_msg void OnSmsStatusLog(WPARAM, LPARAM);
DECLARE_MESSAGE_MAP()
};
/*ChildFrm.cpp*/
// CChildFrame
IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
//{{AFX_MSG_MAP(CChildFrame)
ON_WM_CREATE()
ON_WM_DESTROY()
//}}AFX_MSG_MAP
ON_MESSAGE (WM_USER_UPDATE_STATUS_LOG,OnSmsStatusLog)
END_MESSAGE_MAP()
///////////////////////////////////////////////////////////