首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

定位窗口消息处理函数解决方案

2013-07-08 
定位窗口消息处理函数定位一个窗口消息处理函数long get_proc_fun(HWND hwnd){charname[NUM_STRING]{0}

定位窗口消息处理函数
定位一个窗口消息处理函数

long get_proc_fun(HWND hwnd)
{
char          name[NUM_STRING]={0};;
HINSTANCE     p_instance=NULL;
WNDCLASS      wndclass={0};

GetClassName(hwnd,name,NUM_STRING);
p_instance=(HINSTANCE)GetWindowLong(hwnd,GWL_HINSTANCE);
GetClassInfo(p_instance,name,&wndclass);

return((long)wndclass.lpfnWndProc);
}


对我自己用VC6.0编译的程序就能得到正确结果
为什么对游戏、记事本等等窗口使用返回值 是 FFFF05B9  呢?
返回值不定但是全部是FFFF开头的地址,不是窗口hwnd的消息处理函数地址?

谁能给个定位一个窗口消息处理函数的思路?

[解决办法]
GCL_WNDPROC
Retrieves the address of the window procedure, or a handle representing the address of the window procedure. You must use the CallWindowProc function to call the window procedure. 

这是GetClassLong的说明,我想GetClassInfo中获得的WndProc应该也和这个函数一样,可能是地址,也可能是句柄。因此,我们在进行超类化或子类化时,不要直接调用获得的WndProc,而是要用CallWindoeProc函数来进行调用。
[解决办法]
反汇编一下CallWindowProc函数吧,看看它是怎么做的。

热点排行