delphi 获取活动窗口名?该怎么处理
delphi 获取活动窗口名?
delphi 开发的系统,运行后,怎么样可以把所有活动的窗口名添加到ComboBox1,不能重复?
------解决方案--------------------
delphi 开发的系统,运行后,怎么样可以把所有活动的窗口名添加到ComboBox1,不能重复?
------解决方案--------------------
- Delphi(Pascal) code
procedure TForm1.Button1Click(Sender: TObject); var i : Integer; cmp : TComponent; begin for i := 0 to Application.ComponentCount - 1 do begin cmp := Application.Components[i]; if cmp is TForm then begin if not TForm(cmp).Visible then begin ShowMessage(TForm(cmp).Name); end; end; end; for i := 0 to Screen.FormCount - 1 do begin if not Screen.Forms[i].Visible then begin ShowMessage(Screen.Forms[i].Name); end; end; end;