|
[求助]怎么处理sendmessage的返回值
先安装HOOK,然后发送WM_USER+1传送一个窗口句柄过去子类化,就安装成功了. 我在其他程序调用sendmessage发送WM_USER+2也能得到7758这个值了. |
|
[求助]怎么处理sendmessage的返回值
最后还是子类化搞定了 HHOOK g_hhook = NULL; HINSTANCE m_hInst; WNDPROC OldProc= NULL; //原窗口过程 LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK WindowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam); BOOL APIENTRY DllMain( HANDLE hModule, //DLL入口 DWORD ul_reason_for_call, LPVOID lpReserved ) { m_hInst=(HINSTANCE)hModule; return TRUE; }; extern "C" __declspec(dllexport) HHOOK _stdcall InstallHook(HWND hHwnd) { g_hhook = ::SetWindowsHookEx(WH_CALLWNDPROCRET, (HOOKPROC)KeyboardProc, m_hInst, ::GetWindowThreadProcessId(hHwnd,NULL)); if (g_hhook != NULL) return g_hhook; return 0; } extern "C" __declspec(dllexport) BOOL _stdcall UninstallHook(HHOOK hHook) { return ::UnhookWindowsHookEx(hHook); } LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam) { if(nCode == HC_ACTION) { //PCWPSTRUCT p=(PCWPSTRUCT)lParam; CWPRETSTRUCT *p=(CWPRETSTRUCT*)lParam; if(p->message == WM_USER+1) { HWND retNum; char tt[10]; retNum=(HWND)p->wParam; ltoa((DWORD)retNum,tt,10); ::MessageBox(0,tt,"提示",0); OldProc=(WNDPROC)GetWindowLong(retNum,GWL_WNDPROC); if (SetWindowLong(retNum,GWL_WNDPROC,(long)WindowProc)==0) //子类化 { ::MessageBox(0,"安装失败","提示",0); } //return 77586; } //::MessageBox(0,"hgggg","提示",0); } return ::CallNextHookEx(g_hhook, nCode, wParam ,lParam); } LRESULT CALLBACK WindowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam) { switch(uMsg) { case WM_DESTROY://接收到销毁窗口消息时取消子类化 if (OldProc != NULL) { SetWindowLong(hwnd,GWL_WNDPROC,(long)OldProc); OldProc=NULL; } case WM_USER + 2: ::MessageBox(0,"收到WM_USER+2消息","提示",0); return 7758; } return CallWindowProc(OldProc,hwnd,uMsg,wParam,lParam); } |
|
|
|
[求助]怎么处理sendmessage的返回值
首先谢谢楼上的这位朋友, 但是这样数据不同步额. 我之前试过自己写的程序子类化本窗口,自己处理过程, 然后在写一个主程序,发送消息就可以得到返回值, DLL里面子类化宿主窗口没成功不知道怎么回事. |
|
|
|
[求助]DirectX游戏后台截图
普通窗口PrintWindow是可以画出来的! |
|
|
|
[求助]DirectX游戏后台截图
这样设置了,游戏貌似不能显示了! |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值