Ver Mensaje Individual
  #9  
Antiguo 11-01-2017
angelp4492 angelp4492 is offline
Miembro
 
Registrado: dic 2007
Posts: 99
Reputación: 0
angelp4492 cantidad desconocida en este momento
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

Última edición por angelp4492 fecha: 11-01-2017 a las 20:05:00.
Responder Con Cita