一个类里响应消息的问题
我希望我的类里能响应UI的消息,不知有没有大虾有这方面的简单的例子,发个我:polosheng@yeah.net谢谢
我自己写了个很简单的类,希望这个类能响应WM_LBUTTONDOWN,编译过了,但总不能响应,不知何故,请大家指教了
另外,我是在CWinapp 的派生类里加一个成员变量,在它InitInstance时,new一个自定义类
------------------------------------------------------------------------
#if !defined(AFX_MYMSG_H__F9CB9441_F91B_11D1_8610_0040055C08D9__INCLUDED_)
#define AFX_MYMSG_H__F9CB9441_F91B_11D1_8610_0040055C08D9__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// MyMsg.h : header file
//
#include <afxwin.h>
/////////////////////////////////////////////////////////////////////////////
// CMyMsg CWnd
class CMyMsg : public CWnd
{
DECLARE_DYNAMIC(CMyMsg)
public:
static WNDPROC m_wndProc;
public:
CMyMsg();
private:
//{{AFX_MSG(CFolderDialog)
// NOTE - the ClassWizard will add and remove member functions here.
afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MYMSG_H__F9CB9441_F91B_11D1_8610_0040055C08D9__INCLUDED_)
------------------------------------------------------------------------------------------------------------
#include "MyMsg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyMsg
IMPLEMENT_DYNAMIC(CMyMsg,CWnd)
WNDPROC CMyMsg::m_wndProc = NULL;
BEGIN_MESSAGE_MAP(CMyMsg , CWnd)
//{{AFX_MSG_MAP(CFolderDialog)
// NOTE - the ClassWizard will add and remove mapping macros here.
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
LRESULT CALLBACK WindowProcNew(HWND hwnd,UINT message, WPARAM wParam, LPARAM lParam)
{
return CallWindowProc(CMyMsg::m_wndProc, hwnd, message, wParam, lParam);
}
CMyMsg::CMyMsg()
{
}
void CMyMsg::OnLButtonDown( UINT nFlags, CPoint point )
{
::Beep(1000,1000);
}