oemdiy.cpp

来自「Windows系统OEM信息设置工具」· C++ 代码 · 共 42 行

CPP
42
字号
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
USEFORM("Main.cpp", FormMain);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
    try
    {
         HANDLE hMutex=CreateMutex(NULL,true,"OEMDIY_Flag");    //建立互斥信号量
         if(GetLastError()==ERROR_ALREADY_EXISTS)               //此互斥量已经存在
         {
            ShowMessage("Windows系统OEM信息设置已经在运行中!");
            ReleaseMutex(hMutex);    //释放互斥量
            return 0;     //退出
         }
         Application->Initialize();
         Application->Title = "Windows 系统 OEM 信息设置";
         Application->CreateForm(__classid(TFormMain), &FormMain);
         Application->Run();
    }
    catch (Exception &exception)
    {
         Application->ShowException(&exception);
    }
    catch (...)
    {
         try
         {
             throw Exception("");
         }
         catch (Exception &exception)
         {
             Application->ShowException(&exception);
         }
    }
    return 0;
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?