当前位置:首页 > 网络编程 > 软件语言 > DELPHI > 采用多线程技术来关闭application.messagebox

采用多线程技术来关闭application.messagebox

点击次数:57 次 发布日期:2008-11-09 08:37:41 作者:源代码网
源代码网推荐
广告载入中
//主要思路:在另个个线程查找到该消息框,然后发WM_CLOSE消息
源代码网推荐 //为区别是其他的程序的消息框,我在提示的标题上多了一个空格,其实也可以用其他的办法。
源代码网推荐 //原码如下:
源代码网推荐
源代码网推荐
源代码网推荐 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; //设置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.


源代码网推荐

源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华