Autor Beitrag
DOCa Cola
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64

Vista x64
D2007
BeitragVerfasst: Mi 07.06.06 14:14 
ich habe eine kleine hook dll geschrieben, die ich z.Z an den windows editor (notepad.exe) dranhänge um seine window messages abzufangen. kommunikation zwischen meinem programm und der dll am editor funktioniert auch soweit problemlos.

nun würde ich gerne wissen, welche window message muss ich abfangen um zu merken, wenn sich ein neuer dialog (zum beispiel about box oder suchen dialog) geöffnet hat?
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Mi 07.06.06 17:57 
WM_INITDIALOG,... schau mal in die Delphi API Referenz oder beobachte mit WinSight.
DOCa Cola Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64

Vista x64
D2007
BeitragVerfasst: Mi 07.06.06 22:51 
mit winsight kam ich schon ein stück weiter. danke! jetzt eine andere frage dazu, vielleicht weis ja jemand bescheid:

hier werden die empfangenen window messages verarbeitet
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
function GetMsgProc(Code: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
var
  Msg: PMsg;
begin
    Msg := PMsg(lParam);
    case Msg^.message of
     WM_WINDOWPOSCHANGING : PostMessage(HWND_BROADCAST, ActivationMessage, 0, 0);
     //WM_MOUSEMOVE : PostMessage(HWND_BROADCAST, ActivationMessage, 0, 0);
    else ;
    end;
  Result := CallNextHookEx(HookHandle, Code, wParam, lParam);
end;


und so sieht meine install hook funktion aus
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
function InstallHook(ThreadID: Cardinal): Boolean; stdcall;
begin
  Result := False;
  if HookHandle = 0 then begin
    HookHandle := SetWindowsHookEx(WH_GETMESSAGE, @GetMsgProc, HInstance,ThreadID);
    Result := TRUE;
  end;
end;


das problem ist, das wenn ich nur wm_mousemove beobachten lasse, dann erhält mein programm die postmessage auch, sobald ich mit der maus über das fenster fahre (notepad). Wenn ich wm_windowposchanging beobachten lasse bekommt mein programm nie eine nachricht, wenn ich das notepad fenster bewege. winsight zeigt mir aber definitiv eine windowposchanging nachricht an. woran kann das liegen?

gruß DOCa Cola
DOCa Cola Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64

Vista x64
D2007
BeitragVerfasst: Do 08.06.06 18:04 
naja, ich habe statt wm_getmessage nun wh_cbt genommen, damit gings.