Delphi 进程程序多开调用单元


本文整理自网络,侵删。

 
unit fun;

interface

uses
  Windows,Forms,SysUtils,TlHelp32,ActiveX,ComObj,ShlObj;

procedure  Mutex;//进程互斥
implementation
uses main;


procedure  Mutex;
var
 hMutex:HWND;
begin
///////////////////////////////创建互斥进程/////////////////////////////
  hMutex := CreateMutex(nil,True,'johntao');
  if hMutex <> 0 then
    if GetLastError = ERROR_ALREADY_EXISTS then
    begin
      Application.MessageBox('禁止多开登陆器!','提示信息',MB_OK);
      Application.Terminate;
    end;
///////////////////////////////end/////////////////////////////////////
end;
end.

用法:


begin
  Mutex;//进程互斥
  Application.Initialize;
  Application.CreateForm(Tfrm_main, frm_main);
  Application.Run;
end.

相关阅读 >>

Delphi 调用viewer-windows10 图像浏览器

Delphi想tstringgrid中添加和删除行的方法

Delphi读写文本文件 assignfile reset append

dbgrideh 组件在borland开发工具中应用全攻略

Delphi 时间与相关类型(3): tfiletime、tsystemtime 及 dos 时间

Delphi 取整算法集合

Delphi静态和动态调用dll的实例

Delphi下载官方svn中的示例原码

Delphi 2010下使用sqlitesimpleDelphi连接sqlite数据库及中文乱码问题的解决

Delphi edit中只能输入数字并且只能输入一个小数点

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



打赏

取消

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

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

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

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

评论

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