Windows Service的PreMessageLoop
HRESULT PreMessageLoop(int nShowCmd)
{
HRESULT hr;
{
HRESULT hr;
m_status.dwControlsAccepted =m_status.dwControlsAccepted | SERVICE_ACCEPT_PAUSE_CONTINUE;
hr = __super::PreMessageLoop(nShowCmd);
if (hr == S_FALSE) hr = S_OK; //要这句才能走下去或者在stdafx.h中加入#define _ATL_NO_COM_SUPPORT
hr = __super::PreMessageLoop(nShowCmd);
if (hr == S_FALSE) hr = S_OK; //要这句才能走下去或者在stdafx.h中加入#define _ATL_NO_COM_SUPPORT
//微软Bug, 微软提供处理方法
//hr = CAtlServiceModuleT<CBWSrvModule,IDS_SERVICENAME>::PreMessageLoop(nShowCmd);
// workaround
//if (hr==S_OK && !m_bDelayShutdown)
// hr = CoResumeClassObjects();
//微软Bug, 微软提供处理方法
//hr = CAtlServiceModuleT<CBWSrvModule,IDS_SERVICENAME>::PreMessageLoop(nShowCmd);
// workaround
//if (hr==S_OK && !m_bDelayShutdown)
// hr = CoResumeClassObjects();
//微软Bug, 微软提供处理方法
//初始化自有变量
if (SUCCEEDED(hr))
{
LogEvent(_T("服务启动"));
}
if (SUCCEEDED(hr))
{
LogEvent(_T("服务启动"));
}
return hr;
}
}