超难!!!怎么用 EnumDesktopWindows 对桌面上的所有窗体进行枚举???

turbopeng 2002-03-28 01:41:52
如题。
...全文
156 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
xunji 2002-03-28
  • 打赏
  • 举报
回复
function EnumerateWindows(hWnd: HWND; lParam: LPARAM): BOOL; stdcall;

var
Form1: TForm1;

implementation

procedure TForm1.Button1Click(Sender: TObject);
begin
ListBox1.Items.Clear;
EnumWindows(@EnumerateWindows,0);
end;

function EnumerateWindows(hWnd: HWND; lParam: LPARAM): BOOL;
var
TheText: Array[0..255] of char;
begin
{if the window does not have any text...}
if (GetWindowText(hWnd, TheText, 255)=0) then
Form1.ListBox1.Items.Add(Format('%d = {This window has no text}',[hWnd]))

else

Form1.ListBox1.Items.Add(Format('%d = %s',[hWnd,TheText]));
Result:=TRUE;
end;

TechnoFantasy 2002-03-28
  • 打赏
  • 举报
回复
代码:
http://www.applevb.com/sourcecode/moudle.zip
TechnoFantasy 2002-03-28
  • 打赏
  • 举报
回复
判断窗体的类以及窗体是否可见。

5,391

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧