小弟是菜鸟,请各位大侠详细指点:
问题解决马上给分。请帮我看一下下面的程序有什么问题?桌面上开了窗口但返回的wname总是空的。function EnumWindowsProc(hw: hwnd): Boolean; stdcall;
var
wname: array[0..40] of char;
begin
wname:= '';
if hw<> null then begin
getwindowtext( hw, wname, 40);
form1.ListBox1.Items.Add( string( wname));
end
else
showmessage( 'no handle');
end;procedure TForm1.Button1Click(Sender: TObject);
begin
enumwindows( @EnumWindowsProc, 0);
end;
问题解决马上给分。请帮我看一下下面的程序有什么问题?桌面上开了窗口但返回的wname总是空的。function EnumWindowsProc(hw: hwnd): Boolean; stdcall;
var
wname: array[0..40] of char;
begin
wname:= '';
if hw<> null then begin
getwindowtext( hw, wname, 40);
form1.ListBox1.Items.Add( string( wname));
end
else
showmessage( 'no handle');
end;procedure TForm1.Button1Click(Sender: TObject);
begin
enumwindows( @EnumWindowsProc, 0);
end;
解决方案 »
- 窗体从最小化到正常状态这一过程究竟会不会触发OnShow事件?
- 求算法
- 为什么 使用 ESC 控制指令 控制不了 打印机????????????????????????????急!!!!!!!!!!!!!!!!!!!!!!!!
- with TDataSource.Create(self) do的问题 ?
- 我用dll建立了一个窗体,怎么与之里面的控件通讯?
- Borland Delphi 7 Personal Edition Now Available
- 报表
- 我想在程序向数据库中写内容的时间内,用进度条或是动画见显示进度,如何实现?
- 如何解决TADODataSet的报错“未指定的错误”。
- 谁知道Microsoft的CAB文件用什么工具可以解开?
- 一个简单的RadioButton问题.(在线等)
- HtmlLink 组件制作问题
EnumChildWindows 参数Parent Window Handle值传0即可
To continue enumeration, the callback function must return TRUE; to stop enumeration, it must return FALSE.
你没return true程序就结束了。
所以只要在EnumWindowsProc最后加上result:= true;就可以了。
unsigned(僵哥(VB群:11141442,D群:21590636,SQL:21590536)) ( )问题解决了,谢谢 result:= true; ok