C++日志钩子的用法。钩子过程的编写。高手来帮忙
http://zhidao.baidu.com/question/119168101.html问题提错了分区。这是写的部分,但是不会用来截取鼠标消息和键盘消息,编译出来的...
http://zhidao.baidu.com/question/119168101.html 问题提错了分区。
这是写的部分,但是不会用来截取鼠标消息和键盘消息,编译出来的程序有问题:
LRESULT CALLBACK JournalRecordProc(
int code, // hook code
WPARAM wParam, // undefined
LPARAM lParam // address of message being processed
)
{
if(code==HC_ACTION)
{ EVENTMSG *param=(EVENTMSG*)lParam;
if(param->message==WM_KEYDOWN)//如何使用鼠标消息+键盘消息
{
int u_key;
CString text;
u_key=LOBYTE(param->paramL);
text=u_key;
::AfxMessageBox(text,MB_OK,1);
return 1;//CallNextHookEx(h_hook,code,wParam,lParam);
}
}
}
下面是MSDN里面关于EVENTMSG的介绍,看了半天还是不是很懂!
/*
The EVENTMSG structure contains information about a hardware message sent to the system message queue. This structure is used to store message information for the JournalPlaybackProc callback function.
typedef struct tagEVENTMSG { // em
UINT message;
UINT paramL;
UINT paramH;
DWORD time;
HWND hwnd;
} EVENTMSG;
Members
message
Specifies the message.
paramL
Specifies additional information about the message. The exact meaning depends on the message value.
paramH
Specifies additional information about the message. The exact meaning depends on the message value.
time
Specifies the time at which the message was posted.
hwnd
Handle to the window to which the message was posted.
*/
哥们难道hook只有 WH_KEYBOARD WH_MOUSE这2个????
难道你没发现一些木马没有dll文件也可以获取系统消息吗?我都说了这个是 日子钩子===WH_JOURNALRECORD
还有很多呢。你可以查看MSDN 展开
这是写的部分,但是不会用来截取鼠标消息和键盘消息,编译出来的程序有问题:
LRESULT CALLBACK JournalRecordProc(
int code, // hook code
WPARAM wParam, // undefined
LPARAM lParam // address of message being processed
)
{
if(code==HC_ACTION)
{ EVENTMSG *param=(EVENTMSG*)lParam;
if(param->message==WM_KEYDOWN)//如何使用鼠标消息+键盘消息
{
int u_key;
CString text;
u_key=LOBYTE(param->paramL);
text=u_key;
::AfxMessageBox(text,MB_OK,1);
return 1;//CallNextHookEx(h_hook,code,wParam,lParam);
}
}
}
下面是MSDN里面关于EVENTMSG的介绍,看了半天还是不是很懂!
/*
The EVENTMSG structure contains information about a hardware message sent to the system message queue. This structure is used to store message information for the JournalPlaybackProc callback function.
typedef struct tagEVENTMSG { // em
UINT message;
UINT paramL;
UINT paramH;
DWORD time;
HWND hwnd;
} EVENTMSG;
Members
message
Specifies the message.
paramL
Specifies additional information about the message. The exact meaning depends on the message value.
paramH
Specifies additional information about the message. The exact meaning depends on the message value.
time
Specifies the time at which the message was posted.
hwnd
Handle to the window to which the message was posted.
*/
哥们难道hook只有 WH_KEYBOARD WH_MOUSE这2个????
难道你没发现一些木马没有dll文件也可以获取系统消息吗?我都说了这个是 日子钩子===WH_JOURNALRECORD
还有很多呢。你可以查看MSDN 展开
展开全部
text=u_key;
int 是无法隐式转换为 CString 的,应该用
text.Format(_T("%d"), u_key);
另外楼主只说编译出来的程序有问题,没有说问题在哪。
int 是无法隐式转换为 CString 的,应该用
text.Format(_T("%d"), u_key);
另外楼主只说编译出来的程序有问题,没有说问题在哪。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询