本文整理汇总了C++中CCmdLine::HasParam方法的典型用法代码示例。如果您正苦于以下问题:C++ CCmdLine::HasParam方法的具体用法?C++ CCmdLine::HasParam怎么用?C++ CCmdLine::HasParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCmdLine
的用法示例。
在下文中一共展示了CCmdLine::HasParam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitInstance
//--------------------------------------------------------------------------------
BOOL CSecurityServerApp::InitInstance()
{
BOOL b = ::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS);
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
g_hSingletonMutex = ::CreateMutex(NULL, FALSE, "MCMSSecurityServerSingletonMutex");
if(g_hSingletonMutex == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
{
#ifndef _NOT_A_SERVICE
g_service.AddToMessageLog(_T("SecurityServer already running."));
#endif
TRACE("SecurityServer already running\n");
return FALSE;
}
// create an invisible window
m_pMainWnd = new CWnd;
m_pMainWnd->CreateEx(0, AfxRegisterWndClass(NULL), NULL, 0, 0, 0, 0, 0, NULL, NULL);
AfxEnableControlContainer();
#ifdef _NOT_A_SERVICE
m_pSystem = new CSecuritySystem;
m_pSystem->GetIOSubSystem()->CreateLogFile("C:\\SStest.log", false);
m_pSystem->GetIOSubSystem()->SetTraceLevel(IOMASK_1|IOMASK_2|IOMASK_3|IOMASK_4|IOMASK_5|IOMASK_6);
m_pServiceThread = ::AfxBeginThread((AFX_THREADPROC) ServiceThread, (LPVOID) this);
return TRUE;
#else
CCmdLine cmdLine;
int nIndex;
if(cmdLine.HasParam('I', nIndex) || cmdLine.HasParam("-install", nIndex))
g_service.InstallService();
else
if(cmdLine.HasParam('R', nIndex) || cmdLine.HasParam("-remove", nIndex))
g_service.RemoveService();
else
if(cmdLine.HasParam('E', nIndex) || cmdLine.HasParam("-end", nIndex) || cmdLine.HasParam("-stop", nIndex))
g_service.EndService();
else
{
// must start the system first
m_pSystem = new CSecuritySystem;
if(m_pSystem->GetResultCode() != CResult::noErr)
g_service.AddToMessageLog(_T("Exception occured during SecurityServer startup. Check license file validity."));
CSSConfigPerformance config;
m_pSystem->GetIOSubSystem()->SetTraceLevel(config.m_nTraceLevel);
m_pServiceThread = ::AfxBeginThread((AFX_THREADPROC) ServiceThread, (LPVOID) this);
::Sleep(1000);
g_service.ReportStatus(SERVICE_RUNNING);
// dont destroy the window cuz we'll need it
return TRUE;
}
// we dont need this window
delete m_pMainWnd;
m_pMainWnd = NULL;
return FALSE;
#endif // _DEBUG
}