)取得窗口列表:

来源:互联网 发布:学数据库用什么软件 编辑:程序博客网 时间:2024/05/16 13:52

(4)取得窗口列表:
procedure TForm1.Button4Click(Sender: TObject);
var
hCurrentWindow: HWnd;
szText: array[0..254] of char;
begin
Listbox1.Clear;
//EnumWindows(@EnumWindowsProc, 0); 写了个回调 EnumWindowsProc没效果
hCurrentWindow := GetWindow(Handle, GW_HWNDFIRST);
while hCurrentWindow <> 0 do
begin
    if GetWindowText(hCurrentWindow, @szText, 255) > 0 then
      listbox1.items.Add(StrPas(@szText));
    hCurrentWindow := GetWindow(hCurrentWindow, GW_HWNDNEXT);
end;
end;

原创粉丝点击