Simple ATL 7.0 Service question 
Author Message
 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:
};



Mon, 30 Aug 2004 01:18:07 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. ATL 7.0 NT Service question...

2. Problem with ATL Service with ATL 7.0

3. Simple Question About ATL Service Wizard?

4. Help creating a simple service using ATL Service

5. ATL 7.0 Windows Service generated code

6. Problem with ATL 7.0 service (HELP!)

7. ATL 7.0 Beta 2 Service Bomb

8. ATL 7.0 NT Service problem?

9. Simple ATL Object in my Windows Service

10. Breaking change ATL 7.0 to ATL 7.1

11. Wtl 7.0 with VS 7.0 Question

12. NT Service (simple question)

 

 
Powered by phpBB® Forum Software