创建CreateMutex的时候名字前面加global\\

解决方案 »

  1.   

    在工程的unit里用FindWindow,如果找到了主窗口(以前打开过这个程序)的句柄,就退出应用程序
      

  2.   

    我暂时使用了文件锁的方法,对mutex使用global的方法不是很清楚,能否给出该句完整的代码,谢谢
      

  3.   

    CreateMutex(nil, false, 'project');
      if GetLastError = ERROR_ALREADY_EXISTS then
      begin
        SendMessage(HWND_BROADCAST, RegisterWindowMessage('project'), 0, 0);
        ShowMessage('程序已经运行!');
        Halt(0);
      end;
      

  4.   

    http://msdn.microsoft.com/library/en-us/termserv/termserv/kernel_object_namespaces.asp?
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwxp/html/winxpfus.asp