如题换句话说就是:主窗口出现后能不能知道工程中所有的Form有多少个请不要说类似Application.MainForm.MDIChildCount的答案
解决方案 »
- delphi 问题,很简单的!~~
- adoquery查询语句的参数问题
- 请问一个图像处理的问题。
- ACCESS数据库修复问题,为何出现"这种对象类型不支持该操作"
- 好文共赏 谨以此文献给所有在学习编程和准备学习编程的朋友当然也包括我 一只很菜很菜的菜鸟
- 关于记录集.EOF的问题
- !!!万能图形设计工具(语言),带大量生动的演示,部分源码。免费发送!!!
- 两个简单问题,急切请教!!!谢谢!!!
- 关于DLL中有回调函数的情况
- 各位大虾,帮帮忙!征集delphi的试题
- 请教关于TIdFTP方法List第三个参数ADetails设为false时如何区分文件和文件夹的问题
- 求 RAS2000加密控件 下载地址
这是一个回调函数,应该可以完成你的功能.ParentHandle,设为Application.Handle
var
windowname,windowclass:array[0..144] of char;
windowInfo:TWindowInfo;
begin
GetWindowText(hw,windowname,144);
GetClassName(hw,windowclass,144);
windowInfo:=TWindowInfo.Create;
with windowinfo do
begin
setlength(winname,strlen(windowname));
setlength(winclass,strlen(windowclass));
winname:=strpas(windowname);
winclass:=strpas(windowclass);
end;
Form1.ListBox1.Items.AddObject('',windowinfo);
end;procedure TForm1.FormDestroy(Sender: TObject);
var
i:integer;
begin
for i:=0 to Listbox1.Items.Count-1 do
Listbox1.Items.Objects[i].Free;
end;procedure TForm1.windowinfoSectionResize(HeaderControl: THeaderControl;
Section: THeaderSection);
begin
Listbox1.Invalidate;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
ListBox1.Items.Clear;
EnumWindows(@addwindowinfo,0);//找窗口
end;procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
Listbox1.Canvas.FillRect(Rect);
with TWindowInfo(Listbox1.Items.Objects[index]) do
begin
DrawText(Listbox1.canvas.Handle,Pchar(winname),length(winname),Rect,dt_left or dt_vCenter );
Rect.Left:=Rect.Left+windowinfo.Sections[0].Width;
DrawText(Listbox1.Canvas.Handle,Pchar(winclass),length(winclass),Rect,dt_left or dt_wordbreak);
end;
end;
var
I: Integer;
begin for I :=0 to Screen.FormCount-1 do
ListBox1.Items.Add(Screen.Forms[I].Name);
end;
因为我的窗口没有建立
[Error] uMain.pas(21): Undeclared identifier: 'THeaderControl'
[Error] uMain.pas(22): Undeclared identifier: 'THeaderSection'
[Error] uMain.pas(41): Object or class type required
[Error] uMain.pas(44): Undeclared identifier: 'winname'
[Error] uMain.pas(45): Undeclared identifier: 'winclass'
[Error] uMain.pas(49): Incompatible types: 'TObject' and 'tagWINDOWINFO'
[Error] uMain.pas(57): ';' expected but '.' found
[Error] uMain.pas(60): Undeclared identifier: 'Listbox1'
[Error] uMain.pas(80): Invalid typecast
[Error] uMain.pas(82): Undeclared identifier: 'winname'
[Error] uMain.pas(82): Incompatible types
[Error] uMain.pas(83): Undeclared identifier: 'windowinfo'
[Error] uMain.pas(83): Missing operator or semicolon
[Error] uMain.pas(83): Missing operator or semicolon
[Error] uMain.pas(84): Undeclared identifier: 'winclass'
[Error] uMain.pas(84): Incompatible types
[Error] uMain.pas(91): Undeclared identifier: 'ParentHandle'
[Hint] uMain.pas(21): Private symbol 'windowinfoSectionResize' declared but never used
[Fatal Error] prjWsERP.dpr(8): Could not compile used unit 'pas\uMain.pas'