
ATL 7.0 NT Service question...
I'm trying to convert an old NT service to the new attributed format in VC
7.0.
The service instantiates a COM object which uses Winsock to open several
TCP connections. I also have a timer running. This runs fine in the
de{*filter*},
but when I run it as a service I don't get any WinSock events or timer
messages.
I'm starting from scratch and new to the VC 7.0 model of services.
Can anyone tell me what I'm missing? I'm sure it's something obvious
to anyone knowledgeable, but I can't find any examples of attributed
services from MS.
One other question...
I was able to make my old service run as multiple instances, each using
a separate configuration, but it was awkward. Is there a proper way to do
this?
The following is the simplest example of code that works in the IDE but not
as a service:
[ 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 = ::SetTimer((HWND) NULL, 1, 10000, TimerProc);
return __super::Start(nCmd);
}
////////////////////////////////////////////////////////////////////////////
///
static void CALLBACK TimerProc(HWND hwnd,UINT uMsg, UINT idEvent, DWORD
dwTime)
{
LogEvent(_T("Timer hit"));
_AtlModule.LogEvent(_T("TimerEvent"));
}
UINT m_lTimer;
Quote:
};
Thanks in advance,
Carl