找到控件ID的代码
unit Unit1;
interface
uses
; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
; StdCtrls;
type
; TForm1 = class(TForm)
; ; Memo1: TMemo;
; ; Button2: TButton;
; ; procedure Button2Click(Sender: TObject);
; private
; ; { Private declarations }
; public
; ; { Public declarations }
; end;
var
; Form1: TForm1;
; function EnumWindowsFunc(Handle: THandle; List: TStringList) : boolean ; stdcall;
implementation
{$R *.DFM}
function EnumWindowsFunc(Handle: THandle; List: TStringList) : boolean ; stdcall;
var Caption: array[0..256] of Char;
; p
Char;
; k :integer;
begin
// ;List.Add('**************One Child Windows*******************');
; if GetClassName(Handle,Caption,256) <> 0 then
; ; List.Add('Classname:'+Caption + ' ; handle:' + Inttostr(Handle))
; else
; ; List.Add('Classname:null'+' ; handle:' + Inttostr(Handle));
; Result :=True;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
; ;hanlemu:HWND;
begin
; ;Memo1.Clear;
; ;hanlemu := FindWindow(nil,'TestForm');
; ;EnumChildWindows(hanlemu,@EnumWindowsFunc,LParam(Memo1.Lines));
end;
end.