Thank you for responding to my query. I always appreciate it when people take the time to help. The Run() method in AtlServiceModule calls this method void RunMessageLoop() throw() { MSG msg; while (GetMessage(&msg, 0, 0, 0) > 0) { TranslateMessage(&msg); DispatchMessage(&msg); } } and I have checked and made sure this is being hit. As to only using a timer, my service is instantiating a COM object that uses WinSock messages (that weren't processed either). I have since written my own WinSock module that uses overlapped IO, but I am rather stubborn and would like to know WHY this code doesn't work. Timers worked fine in a service generated under VC6. Again, I'd like to thank the people that have responded to my query. I posted the same question in a newsgroup and no one responded.
Carl
Posts
-
ATL 7.0 & NT Service. -
ATL 7.0 & NT Service.Thanks for the response. The ATL service code includes 3 methods PreMessageLoop(); RunMessageLoop(); PostMessageLoop(); Which lead me to think (incorrectly?) that this should work. It worked with the ATL code with version 6.0, although a lot of the code that had been explicitely generated before is now contained in CAtlServiceModuleT.
-
ATL 7.0 & NT Service.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? Carl /////////////////////////////////////////////////////////////////////////// [ 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; };