Einzelnen Beitrag anzeigen

Benutzerbild von Remko
Remko

Registriert seit: 10. Okt 2006
Ort: 's-Hertogenbosch, Die Niederlande
222 Beiträge
 
RAD-Studio 2010 Arc
 
#4

AW: HookHop von PostMessage geht nicht

  Alt 16. Jun 2010, 20:15
PostMessageA has the stdcall calling convention but your function _PostMessage does not!
You should declare _PostMessage as stdcall and remove the begin and end (then delphi doesn't create a stackframe):
Delphi-Quellcode:
function _PostMessage(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): BOOL; stdcall;
  asm
    jmp dword ptr ds:[PostMessageReal];
    mov eax, 1;
  end;
end;

procedure TForm1.ToolButton1Click(Sender: TObject);
var
  wnd: hwnd;
begin
  wnd := FindWindowEx(hauptwnd, 0, 'Edit', '');
  _PostMessage(Wnd, WM_CHAR, Ord('A'), 0);
end;
It's not clear to me though why you are incrementing the function pointer by 5 (or why the c code does that), also are you supposed to increment by 5 bytes or by 5 dword's ?
See my blog blog
See our Jedi blog
  Mit Zitat antworten Zitat