globalny hook systemowy na msg WM_MOVE

0

Hej

Potrzebuje sprawdzac na bieŻąco zmiane ukladu okien na pulpicie i w zwiazku z tym potrzebuje zrobic hook'a na komunikat np Wm_MOVE czy WM_SIZE

Wedlug mojej teorii nie wszystkie hook'i sie tego nadaja bo czesc wylapuje tylko np komunikaty mysz, klawiatury itp.
Zgodnie tym wyczytalem ze chyba najlepszym typem hook'a jest w tym wypadku WH_CALLWNDPROCRET

Kto wie cos na ten temat jak to zrobic lub co jest nie tak w kodzie ponizej prosze o znak.

var H:THandle;

function hook1(c0de, wParam, lParam : integer): Lresult; stdcall;
var
  hw : hwnd;
  pCWPR: PCWPRetStruct;
begin
  if c0de>0 then
  begin
    pCWPR := PCWPRetStruct(lParam);
    if (pCWPR.message = WM_MOVE) then
      begin
        form1.r.Lines.Add('ok'); //cos tam napisz
      end;
    CallNextHookEx(H, c0de, wParam, lParam);
  end else
  begin
    result := CallNextHookEx(H, c0de, wParam, lParam);
    exit;
  end;
  result := CallNextHookEx(H, c0de, wParam, lParam);
End;




procedure sethook;
begin
  H:=SetWindowsHookEx({WH_CBT}WH_CALLWNDPROCRET, @hook1, hInstance, 0);
  if H = 0 then messagebox(0,'error','error',mb_iconhand);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  sethook;
end;
0

Moze ktos wie jak to wykryc?
Bys moze treba zrobic inny Hook. Lista dostepnych ponizej:

WH_CALLWNDPROC Installs a hook procedure that monitors messages before the system sends them to the destination window procedure. For more information, see the CallWndProc hook procedure. WH_CALLWNDPROCRET Installs a hook procedure that monitors messages after they have been processed by the destination window procedure. For more information, see the CallWndRetProc hook procedure. WH_CBT Installs a hook procedure that receives notifications useful to a computer-based training (CBT) application. For more information, see the CBTProc hook procedure. WH_DEBUG Installs a hook procedure useful for debugging other hook procedures. For more information, see the DebugProc hook procedure. WH_GETMESSAGE Installs a hook procedure that monitors messages posted to a message queue. For more information, see the GetMsgProc hook procedure. WH_JOURNALPLAYBACK Installs a hook procedure that posts messages previously recorded by a WH_JOURNALRECORD hook procedure. For more information, see the JournalPlaybackProc hook procedure. WH_JOURNALRECORD Installs a hook procedure that records input messages posted to the system message queue. This hook is useful for recording macros. For more information, see the JournalRecordProc hook procedure. WH_KEYBOARD Installs a hook procedure that monitors keystroke messages. For more information, see the KeyboardProc hook procedure. WH_MOUSE Installs a hook procedure that monitors mouse messages. For more information, see the MouseProc hook procedure. WH_MSGFILTER Installs a hook procedure that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar. For more information, see the MessageProc hook procedure. WH_SHELL Installs a hook procedure that receives notifications useful to shell applications. For more information, see the ShellProc hook procedure. WH_SYSMSGFILTER

1 użytkowników online, w tym zalogowanych: 0, gości: 1