分类: C/C++
2008-01-28 21:59:42
//#define UM_SOCK (WM_USER+0x...)
//in .h file
afx_msg void On...(WPARAM w,LPRARAM l);
//in .cpp file
BEGIN_MESSAGE_MAP(..., ...)
//{{AFX_MSG_MAP(...)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_CREATE, OnCreate)
ON_CBN_SELENDOK(IDC_TABLE, OnSelTable)
ON_BN_CLICKED(IDC_LOAD, OnLoad)
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
//must out out comment //afx_msg_map, Q.W. classwizrad would
//delete your ampping code
ON_MESSAGE(UM_SOCK,On...)
END_MESSAGE_MAP()
void xxxx:On...(WPARAM w,LPARAM l)
{
//codes go here
}
#define UM_SOCK (WM_APP+1)
在.h文件中加入
afx_msg void OnUmsock(WPARAM wParam, LPARAM lParam);
在.cpp文件中进入
BEGIN_MESSAGE_MAP(..)
...
ON_MESSAGE(UM_SOCK, OnUmsock)
...
END_MESSAGE_MAP()
....
void CYourClass::OnUmsock(WPARAM wParam, LPARAM lParam)
{
}
同意楼上
//#define UM_SOCK (WM_USER+0x...)
//in .h file
afx_msg LRESULT On...(WPARAM w,LPRARAM l);//这里没有使用void
//in .cpp file
BEGIN_MESSAGE_MAP(..., ...)
//{{AFX_MSG_MAP(...)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_CREATE, OnCreate)
ON_CBN_SELENDOK(IDC_TABLE, OnSelTable)
ON_BN_CLICKED(IDC_LOAD, OnLoad)
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
//must out out comment //afx_msg_map, Q.W. classwizrad would
//delete your ampping code
ON_MESSAGE(UM_SOCK,On...)
END_MESSAGE_MAP()
LRESULT xxxx:On...(WPARAM w,LPARAM l)//这里也改动了
{
//codes go here
}
这是更新的方法。