用户登录  |  用户注册
首 页 ┆ 商业源码 ┆ 原创产品 ┆ 编程论坛
当前位置:PB创新网 → 文章中心 → 编程技巧 → Delphi

查阅可视窗口标题

减小字体 增大字体 作者:佚名  来源:本站整理  发布时间:2009-03-16 20:00:36
我们可以通过下面的例子了解查阅可视窗口的标题。即运用API函数GetWindow()配合GetWindowText()逐一查出各视窗的标题。

    新建一个工程,在 Form1 中安排 Button 与 Memo 各一, 在 Button1 的 onClick 事件中写上如下代码:

    procedure TForm1.Button1Click(Sender: TObject);

    var

    hCurrentWindow: HWnd;

    szText: array[0..254] of char;

    begin

    hCurrentWindow := GetWindow(Handle, GW_HWNDFIRST);

    while hCurrentWindow <> 0 do

    begin

    if GetWindowText(hCurrentWindow, @szText, 255)>0 then

    Memo1.Lines.Add(StrPas(@szText));

    hCurrentWindow:=GetWindow(hCurrentWindow, GW_HWNDNEXT);

    end;

end;

Tags:

作者:佚名

文章评论评论内容只代表网友观点,与本站立场无关!

   评论摘要(共 0 条,得分 0 分,平均 0 分) 查看完整评论

相关文章

PB创新网【ourmis.com】Copyright © 2000-2009 . All Rights Reserved .
页面执行时间:18,890.63000 毫秒
Email:ourmis@126.com QQ:2322888 蜀ICP备05006790号