WM_PAINT Hook using SetWindowsHookEx

我怕爱的太早我们不能终老 提交于 2020-01-03 02:26:26

问题


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 ?


回答1:


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



来源:https://stackoverflow.com/questions/5432551/wm-paint-hook-using-setwindowshookex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!