Capturar Handle, Classe e Caption da janela filho

Delphi

09/12/2013

Boa tarde galera, estou precisando capturar janela filho ativa e encontrei essa opção

[url]http://www.delphifaq.com/faq/delphi/windows_GUI/f455.shtml[/url]

Minha dúvida é com relação a passagem de parâmetros na hora de chamar a função. Alguém poderia dar uma força aqui? O que eu não entendi é que ele pede nos parâmetros exatamente o que é pra retornar, não entendo isso :D

obrigado.
Luiz Eduardo

Luiz Eduardo

Curtidas 0

Respostas

Andre Santos

Andre Santos

09/12/2013



Tambem não entendi muito esse exemplo. Tenho este outro aki que informa tudo isso bastando apontar o mouse, dependendo do que voce queira basta adaptar:


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    Label1: TLabel;
    Label2: TLabel;
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}


procedure TForm1.Timer1Timer(Sender: TObject);
var 
   buffer : String; 
   hWnd: THandle; 
   pt : TPoint; 
   txSize : Integer; 
begin 
   GetCursorPos(pt); // pega a posição do mouse 
   hWnd := WindowFromPoint(pt); // pega o Handle 
   SetLength(buffer, 256); 
   if (GetClassName(hWnd, pchar(buffer), 256) = 0) then buffer := 'nil';
   Label1.Caption := 'Handle = '+IntToStr(hWnd)+' Class = '+buffer;
   txSize := SendMessage(hWnd, WM_GETTEXTLENGTH, 0, 0); 
   SetLength(buffer, txSize); 
   SendMessage(hWnd, WM_GETTEXT, txSize + 1, longint(buffer));
  Label2.Caption := buffer;
end;

end.
GOSTEI 0
Luiz Eduardo

Luiz Eduardo

09/12/2013

Caro André, valeu mesmo cara pela ajuda, com certeza sua dica será de grande utilidade!

o propósito é capturar o handle e a classe da janela corpo do Google Chrome :D
GOSTEI 0
POSTAR