使用 SetWindowsHookEx 的 WM_PAINT 挂钩
这是我的代码
// hook.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windows.h>
#include <iostream>
using namespace std;
LRESULT CALLBACK GetMsgProc(int code, WPARAM wParam, LPARAM lParam);
int _tmain(int argc, _TCHAR* argv[]){
int __;
cout << "Hallo World" << endl;
SetWindowsHookEx(WH_GETMESSAGE, GetMsgProc, 0, 0);
cin >> __;
return 0;
}
LRESULT CALLBACK GetMsgProc(int code, WPARAM wParam, LPARAM lParam){
cout << code << endl;
return 0;
}
我正在尝试获取 WM_PAINT 事件...目前我正在尝试捕获所有事件。我在哪里失踪了?
Here Goes My Code
// hook.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windows.h>
#include <iostream>
using namespace std;
LRESULT CALLBACK GetMsgProc(int code, WPARAM wParam, LPARAM lParam);
int _tmain(int argc, _TCHAR* argv[]){
int __;
cout << "Hallo World" << endl;
SetWindowsHookEx(WH_GETMESSAGE, GetMsgProc, 0, 0);
cin >> __;
return 0;
}
LRESULT CALLBACK GetMsgProc(int code, WPARAM wParam, LPARAM lParam){
cout << code << endl;
return 0;
}
I am trying to get WM_PAINT event... at the moment I am trying to trap all the events. Where I am Missing ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请阅读文档。它清楚地说明了为什么您的用法不正确,尤其是最后两个参数。如果你想挂钩每个线程,你需要提供一个模块
http://msdn.microsoft.com/en-我们/库/ms644990(v=vs.85).aspx
Read the documentation please. It clearly states why your usage is incorrect especially with regard to the last two parameters. If you want to hook every thread you need to provide a module
http://msdn.microsoft.com/en-us/library/ms644990(v=vs.85).aspx