#include <iostream>
#include <Windows.h>
using namespace std;

int main()
{
    HANDLE hMutex = CreateMutex(NULL,TRUE,L"OnlyInstance");
    if (hMutex)
    {
        if (ERROR_ALREADY_EXISTS == GetLastError())
        {
            cout<<"Already exist"<<endl;
            return 0;
        }
        else
        {
            cout<<"An instance"<<endl;
        }
    }
    else
    {
        cout<<"ERROR_INVALID_HANDLE"<<endl;
    }
    system("pause");
    return 0;
}

相关文章:

  • 2021-09-14
  • 2022-01-18
  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
  • 2022-03-02
  • 2021-06-23
  • 2021-05-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-23
  • 2021-06-24
  • 2022-12-23
  • 2022-02-27
相关资源
相似解决方案