1.取出全部标题
D2007版本
procedure TForm1.Button1Click(Sender: TObject);
var
hCurrentWindow:HWnd;
szText: array[0..254] of char;
szClassName: array[0..254] of char;
begin
ListBox1.Items.Clear;
hCurrentWindow := GetWindow(Handle, GW_HWNDFIRST);
while hCurrentWindow <> 0 do
begin
GetClassName(hCurrentWindow, @szClassName, 255);
if (GetWindowText(hCurrentWindow, @szText, 255)>0) and
(String(szClassName)=‘TXGuiFoundation‘) and
(String(szText)<>‘TXFloatingWnd‘) and
(String(szText)<>‘TXMenuWindow‘) then
ListBox1.Items.Add(StrPas(@szText));
hCurrentWindow:=GetWindow(hCurrentWindow, GW_HWNDNEXT);
end;
end;
DXE10.2版本
procedure TForm1.Button1Click(Sender: TObject);
var
hCurrentWindow:HWnd;
szText: array[0..254] of WideChar;
szClassName:array[0..254] of WideChar;
begin
ListBox1.Items.Clear;
hCurrentWindow := GetWindow(Handle, GW_HWNDFIRST);
while hCurrentWindow <> 0 do
begin
GetClassName(hCurrentWindow, @szClassName, SizeOf(szClassName));
if (GetWindowText(hCurrentWindow, @szText, SizeOf(szText))>0)
and (String(szClassName)=‘TXGuiFoundation‘)
and (String(szText)<>‘TXFloatingWnd‘) and
(String(szText)<>‘TXMenuWindow‘)
then
ListBox1.Items.Add(StrPas(szText));
hCurrentWindow:=GetWindow(hCurrentWindow, GW_HWNDNEXT);
end;
end;