首页 > 代码库 > 遍历当前窗口名字

遍历当前窗口名字

procedure TForm1.btn1Click(Sender: TObject);  var    h: HWnd;    p: array[0..254] of char;    TitleStr: string;  begin    h := GetWindow(Handle, GW_HWNDFIRST);    while h <> 0 do    begin      if GetWindowText(h, @p, 255) > 0 then      begin        TitleStr := StrPas(p);        if AnsiPos(‘计算器‘,TitleStr)>0 then  //查找比较是否>0        begin          mmo1.Lines.Add(p);        end;        end;      h := GetWindow(h, GW_HWNDNEXT);    end;  end;  

  

遍历当前窗口名字