是用钩子(HOOK)啊。可我没有得到我要的消息,下面是我的代码,那位帮忙看看:<br>function EnabledesktopHook(h: HWND): Boolean; stdcall;<br>var wnd:HWND;<br>begin<br> if SData.hHk <> 0 then begin<br> Result := false;<br> exit;<br> end;<br> SData.Wnd := h;<br> SData.recvl := RegisterWindowMessage('tsdf&%$#klhjds)*(dkfgj');<br> SData.recvr := RegisterWindowMessage('tguw,em%^$fnj*^d)*bfgj');<br> Wnd := GetDesktopWindow;<br> Wnd := FindWindowEx(Wnd, 0, 'Progman', nil);<br> SData.hHk := SetWindowsHookEx(WH_CBT,DesktopHookProc,0{hInstance},Wnd);<br> Result:=SData.hHk<>0;<br>end;<br><br>function DesktopHookProc(nCode: integer; wParam, lParam: longint): LRESULT; stdcall;<br>begin<br> if nCode <0 then begin<br> Result:=CallNextHookEx(SData.hHk,nCode,wParam,lParam);<br> exit;<br> end;<br> if (nCode=HC_ACTION) then<br> if wParam=WM_SETFOCUS then begin//获得焦点<br> SendMessage(SData.Wnd,SData.recvl,0,0);<br> end;<br> Result:=0;<br>end;