Delphi WinAPI: GetFocus - 获取当前拥有焦点的窗口的句柄


本文整理自网络,侵删。

 
WinAPI: GetFocus - 获取当前拥有焦点的窗口的句柄
//声明:
GetFocus: HWND; {无参数; 返回当前拥有焦点窗口的句柄}


//举例:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    Edit1: TEdit;
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
var
  h: HWND;
begin
  h := GetFocus;
  Text := IntToStr(h);
end;

end.

相关阅读 >>

Delphi xe8 numberbox使用方法及存在的问题

Delphi文本数据导入数据库的方法

Delphi listbox模糊查找文字

Delphi xe6 通过javascript api调用百度地图

Delphi unigui中cookies使用中文汉字的方法

Delphi动态建立panel无法更改颜色?

Delphi tidhttp 登录网页封装

Delphi tlist性能注意事项

Delphi控制程序在任务栏显示与隐藏

Delphi内存映射 与 映射数据获取

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...