![](https://csdnimg.cn/release/download_crawler_static/71929892/bg1.jpg)
delphi 实现延时自动关闭对话框
{*******************************************************}
{ 一种自动关闭对话框的简单方法 }
{ 使用方法:打开对话框前调用 SetDlgAutoClose }
{ 参数 1: 设定多长时间后关闭 }
{ 参数 2: 是否在对话框标题栏进行倒计时提示 }
{ 取消自动关闭调用 ResetDlgAutoClose }
{*******************************************************}unit
TimerDlg;interfaceuses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls,
Forms, ExtCtrls;// 如果指定的时间没有操作对话框,则自动
关闭
procedure ResetDlgAutoClose;
procedure SetDlgAutoClose(nTime: Integer; ADoHint:
Boolean = False);implementation{** 如果对话框被打开,则
在指定时间后关闭,并在标题栏进行提示 }
var
nWndCount: Integer = 0;
SavWnds, SavWnds2: array of THandle;
hDlgWnd: THandle = 0;