随笔分类 -  程序控制

防止程序重复运行 互斥
摘要:将下面的代码放到工程文件中uses windows;...var MutexHandle:Thandle; begin Mutexhandle:=windows.CreateMutex(nil,true,'能代表程序特点的字符串');if Mutexhandle<>0 thenbeginif get 阅读全文
posted @ 2013-05-05 23:55 del88 阅读(56) 评论(0) 推荐(0)
关于禁止程序重复启动的另一种需要与实现
摘要:手头的程序需要禁止重复启动, 但需要保留新的、关闭旧的. 我想还是从主窗口的类名下手吧; 写了一个函数, 在 OnCreate 中调用即可: { 函数 } procedure CloseSameClassNameWindow(ACurrentWindow: HWND; const AClassNam 阅读全文
posted @ 2013-05-05 23:28 del88 阅读(16) 评论(0) 推荐(0)
防止程序重复执行的单元
摘要://工程引用此单元就能防止同时出现多个实例 unit MultInst; interface uses Windows ,Messages, SysUtils, Classes, Forms; implementation const STR_UNIQUE = '{2BE6D96E-827F-4BF 阅读全文
posted @ 2013-05-05 23:26 del88 阅读(153) 评论(0) 推荐(0)