我的项目中是用EXE进行各个模块调用的.
请问实现程序运行一个实例?

解决方案 »

  1.   

    http://www.csdn.net/develop/read_article.asp?id=20379
      

  2.   

    将下面的代码稍加改动,加入工程文件
    var
      hMutex: THandle;
    begin
      hMutex := OpenMutex( MUTEX_ALL_ACCESS, FALSE, 'MyMutex' );
      if hMutex<>0 then //已存在实例
        begin
          CloseHandle( hMutex );
        end
      else
        begin
          hMutex := CreateMutex( nil, FALSE, 'MyMutex' );      Application.Initialize;
          Application.CreateForm(TMainFrm, MainFrm);
          ...
        end
    end