MSG Structure是这么定义的
The MSG structure has the following form:typedef struct tagMSG { // msg
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
} MSG;
当我重载
BOOL CXXXXXDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_LBUTTONDOWN)
{
if(pMsg->hwnd == ((CWnd*)GetDlgItem(IDC_BTDOME_01))->m_hWnd)
处理;
}}
可以根据Id来判断控件
但是这样为什么不行呢
BOOL CXXXXXDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_LBUTTONDOWN)
{
if(LOWORD(pMsg->wparam) == IDC_BTDOME_01)
处理;
}}
用Oncommnd却可以根据wparam判断id
The MSG structure has the following form:typedef struct tagMSG { // msg
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
} MSG;
当我重载
BOOL CXXXXXDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_LBUTTONDOWN)
{
if(pMsg->hwnd == ((CWnd*)GetDlgItem(IDC_BTDOME_01))->m_hWnd)
处理;
}}
可以根据Id来判断控件
但是这样为什么不行呢
BOOL CXXXXXDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_LBUTTONDOWN)
{
if(LOWORD(pMsg->wparam) == IDC_BTDOME_01)
处理;
}}
用Oncommnd却可以根据wparam判断id
解决方案 »
- windows下怎么开发c++守护进程?
- 大家来讨论一下,什么时候析构函数决不能定义为虚的
- 5555555~~~请人半个我一下,否则我就没饭吃了啊,谢谢
- 哪位老大可以提供完整的获取数据包的vc++程序(winsoket and winpcap)
- 那位好心人帮帮我!只有10分啦
- [原创] 理解I/O Completion Port [IOCP]
- 今天新增一个三角 已经给出300分了 心里舒畅啊:D
- 谁懂Advanced Installer?麻烦进来看下!
- DLL 模块如何访问主控程序中定义的变量
- 局域网斗地主VC源码
- 求助,多媒体定时器,多线程定时器问题
- SetWindowsHookEx注入问题,很疑惑,大家帮忙,谢谢
在Oncommnd 处理函数要晚于WM_LBUTTONDOWN消息,是系统处理之后,再传递id值给oncommnd
在WM_LBUTTONDOWN消息处理只有虚拟码,详细可参考msdn关于两个消息的说明
LPARAM lParam;
ParameterswParam
Indicates whether various virtual keys are down. This parameter can be one or more of the following values.
MK_CONTROL
The CTRL key is down.
MK_LBUTTON
The left mouse button is down.
MK_MBUTTON
The middle mouse button is down.
MK_RBUTTON
The right mouse button is down.
MK_SHIFT
The SHIFT key is down.
MK_XBUTTON1
Windows 2000/XP: The first X button is down.
MK_XBUTTON2
Windows 2000/XP: The second X button is down.
lParam
The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.