全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1295
推到 Plurk!
推到 Facebook!

Message 自動關閉

 
squall36
一般會員


發表:4
回覆:2
積分:1
註冊:2006-07-31

發送簡訊給我
#1 引用回覆 回覆 發表時間:2006-07-31 13:39:58 IP:211.20.xxx.xxx 訂閱

請教大大~

Message 自動關閉(一分鐘後)

------
vincent
squall36
一般會員


發表:4
回覆:2
積分:1
註冊:2006-07-31

發送簡訊給我
#2 引用回覆 回覆 發表時間:2006-07-31 15:17:48 IP:211.20.xxx.xxx 訂閱

var myclose:tcloseother;

begin
myclose:=tcloseother.Create(false);
myclose.FreeOnTerminate:=true;
application.MessageBox('程序已執行!','消息提示 ',mb_ok mb_iconinformation);
end;

unit closeother;

interface

uses
Classes,messages,sysutils,windows,forms;

type
tcloseother = class(TThread)
private
{ Private declarations }
protected
procedure Execute; override;
public
//procedure create(myhwnd:integer);
end;

implementation

{ Important: Methods and properties of objects in VCL can only be used in a
method called using Synchronize, for example,

Synchronize(UpdateCaption);

and UpdateCaption could look like,

procedure tcloseother.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }

{ tcloseother }


//procedure tcloseother.create(myhwnd: integer);
//begin
//end;

procedure tcloseother.Execute;
const
NumSec=5; //執行五秒後自動關閉
var
messagehwnd:integer;
starttime:tdatetime;
begin
StartTime := now;
repeat
Application.ProcessMessages;
until Now > StartTime NumSec * (1/24/60/60);
messagehwnd:=FindWindow(nil,'消息提示 ');
postmessage(messagehwnd,wm_close,0,0);
end;

end.

------
vincent
系統時間:2024-04-20 6:26:35
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!