使用SetWindowsHookEx的WM_PAINT挂钩 [英] WM_PAINT Hook using SetWindowsHookEx

查看:238
本文介绍了使用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事件...此刻我正在尝试捕获所有事件.我在哪里失踪?

I am trying to get WM_PAINT event... at the moment I am trying to trap all the events. Where I am Missing ?

推荐答案

请阅读文档.它清楚地说明了为什么您的用法不正确,尤其是对于最后两个参数.如果要挂接每个线程,则需要提供一个模块 http://msdn.microsoft.com/zh-我们/图书馆/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

这篇关于使用SetWindowsHookEx的WM_PAINT挂钩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆