Lazarus中文社区

 找回密码
 立即注册(注册审核可向QQ群索取)

QQ登录

只需一步,快速开始

版权申明
查看: 5489|回复: 1

得到当前活动窗体的标题

[复制链接]
  • TA的每日心情
    奋斗
    2022-6-24 15:56
  • 签到天数: 10 天

    [LV.3]偶尔看看II

    发表于 2010-1-16 11:32:56 | 显示全部楼层 |阅读模式
    转自:http://www.solokey.cn/
    function  GetActiveWindowText: string;
    var
      hnd: HWND;
      stlen: Integer;
    begin
      hnd := GetForegroundWindow;
      stlen := GetWindowTextLength(hnd);
      SetLength(Result, stlen);
      GetWindowText(hnd, PChar(Result), stlen);
    end;
    顺便一提,GetActiveWindow只能得到调用进程内的窗体Handle.
    回复

    使用道具 举报

    该用户从未签到

    发表于 2010-2-1 18:42:15 | 显示全部楼层
    以上程序在lazarus编译提示如下信息,请教如何解决

    unit1.pas(33,12) Error: Identifier not found "HWND"
    unit1.pas(33,12) Error: Error in type definition
    unit1.pas(36,29) Error: Identifier not found "GetForegroundWindow"
    unit1.pas(37,31) Error: Identifier not found "GetWindowTextLength"
    unit1.pas(38,19) Error: Identifier not found "Result"
    unit1.pas(38,19) Error: Variable identifier expected
    unit1.pas(39,16) Error: Identifier not found "GetWindowText"
    unit1.pas(39,34) Error: Identifier not found "Result"
    unit1.pas(47) Fatal: There were 8 errors compiling module, stopping
    回复 支持 反对

    使用道具 举报

    *滑块验证:

    本版积分规则

    QQ|手机版|小黑屋|Lazarus中国|Lazarus中文社区 ( 鄂ICP备16006501号-1 )

    GMT+8, 2025-1-14 07:25 , Processed in 0.034182 second(s), 10 queries , Redis On.

    Powered by Discuz! X3.4

    Copyright © 2001-2021, Tencent Cloud.

    快速回复 返回顶部 返回列表