
Simple ATL 7.0 Service question
Can anyone tell me what (obvious to everyone else) piece I'm missing.
The following code doesn't work when run as a service. It runs fine
when run through the IDE. All it does is set a timer. The SetTimer returns
a valid number, but the TimerProc callback is never hit.
Any ideas?
///////////////////////////////////////////////////////////////////////////
[ module(SERVICE, uuid = "{99CCA443-725A-44F2-A5F3-9855AFACF970}",
name = "QService",
helpstring = "QService 1.0 Type Library",
resource_name="IDS_SERVICENAME") ]
class CQServiceModule
{
public:
CQServiceModule() {};
public:
HRESULT PreMessageLoop(int nShowCmd)
{
HRESULT hr = __super::PreMessageLoop(nShowCmd);
if ( SUCCEEDED(hr) )
return S_OK;
return hr;
}
HRESULT Start(int nCmd)
{
m_lTimer = (UINT)::SetTimer((HWND) NULL, 1, 10000, TimerProc);
return __super::Start(nCmd);
}
static void CALLBACK TimerProc(HWND hwnd,UINT uMsg, UINT idEvent,
DWORD dwTime)
{
_AtlModule.LogEvent(_T("TimerEvent"));
}
UINT m_lTimer;
Quote:
};