G
gongxingg
Unregistered / Unconfirmed
GUEST, unregistred user!
大虾们看一下啊,为什么下面的代码无法钩住全局的消息,只能钩住本窗体的消息?<br>看来对WINDOWS里的程序抛媚眼还真困难啊。<br>如果把它放到DLL里去,干脆连调用程序的窗体就没有任何反应了.并且这样一来设置连点击窗口最大化的按钮等消息也截取不了,但我记得截取那个的消息的确是WM_SYSCOMMAND啊.<br>555~救.......命........啊...........![]<br>怎么才能做成全局的钩子啊?<br>var MyHook:Hhook;<br>function ggg(iCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;<br>begin<br> Result := 0;<br> If iCode < 0 Then Result := CallNextHookEx(myhook, iCode, wParam, lParam);<br> case PMsg(lParam)^.message of<br> WM_SYSCOMMAND:<br> BEGIN<br> case PMsg(lParam)^.wParam of<br> SC_MAXIMIZE:showmessage('1');<br> SC_MINIMIZE :showmessage('2');<br> SC_CLOSE :showmessage('3');<br> SC_SIZE :showmessage('4');<br> SC_MOVE :showmessage('5');<br> SC_RESTORE : showmessage('6');<br> end;<br> END;<br> end;<br>end;<br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> end;<br> myhook:=Setwindowshookex(wh_GETMESSAGE,ggg,hinstance,0);<br>end;