5,388
社区成员
发帖
与我相关
我的任务
分享
function GetHandleAndClassName(Handle: HWND; v: integer): Boolean; stdcall;
var
Buf: array[0..1024] of Char;
begin
GetClassName(Handle, Buf, 1024); // 得到类名
ClassNameText.Caption :='类: '+Buf;
SendMessage(Handle, WM_GETTEXT, 33, Integer(@Buf)); // 得到标题
TitleText.Caption :='标题: '+Buf;
HandleText.Caption :='句柄(Hex): '+IntToHex(Handle,0);//句柄
result := true;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
HD:HWND;
begin
HD:=FindWindow(nil,'需要查找的窗体标题');
if HD <> 0 then
EnumChildWindows(Handle, @GetHandleAndClassName, 0);
end;