PreTranslateMessage(MSG* pMsg)中的参数是什么意思

如题所述

Points to a MSG structure that contains the message to process.
指向 MSG 结构体的指针。
MSG 结构体定义如下:
typedef struct tagMSG { // msg
HWND hwnd; // 窗口句柄
UINT message; // 消息
WPARAM wParam; // 消息附加信息,根据消息而定
LPARAM lParam; // 消息附加信息,根据消息而定
DWORD time; // 消息发送时间
POINT pt; // 消息发送时指针的位置(屏幕坐标)
} MSG;

参考资料:msdn

温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-06-07
顶楼上的
指向MSG结构体的指针
系统会帮你传递这个参数不用你管 你要做的只是在这个函数内处理它
比如 截获键盘输入
BOOL CXXXDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_KEYDOWN)
WritePrivateProfileString("OO", "XX", CString(pMsg->wParam), "F:\\log.ini");

return CDialog::PreTranslateMessage(pMsg);
}