Hola me surgió una nueva duda. ahora que todo va bien con la inyección y el hook al mouse, intento capturar el titulo de la ventana activa al pulsar un boton pero no me sale. Lo he intentado con GetwindowsText pero en la MSDN dice que si estamos en otro proceso utilizar SendMessage con WM_GETTEXT.
este es el codigo en condiciones normales si funciona.
Código Delphi
[-]
function GetWindowText: WideString;
var
TextLength: Integer;
Text: PWideChar;
wnd: HWND;
begin
Result := '';
if wnd = 0 then
Exit;
wnd:=GetActiveWindow;;
TextLength := SendMessageW(wnd, WM_GETTEXTLENGTH, 0, 0);
if TextLength <> 0 then
begin
GetMem(Text, TextLength * 2 + 1);
SendMessageW(wnd, WM_GETTEXT, TextLength + 1, Integer(Text));
Result := Text;
FreeMem(Text);
end;
end;
que estoy haciendo mal, donde se me ha perdido el handle