防多开

// 08 放多开.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <windows.h>

HANDLE  hMutex = NULL;
int _tmain(int argc, _TCHAR* argv[])
{
    hMutex = OpenMutex(MUTEX_ALL_ACCESS, FALSE, L"15PB");
    if (hMutex == NULL)
    {
        CreateMutex(NULL, FALSE, L"15PB");
    }
    else
    {
        return 0;
    }
    printf("Helloworld");
    system("pause");
    return 0;
}

 

posted @ 2016-03-24 21:35  天还是那么蓝  阅读(124)  评论(0编辑  收藏  举报