CAtlServiceModuleT::Handler

The handler routine for the service.

void Handler( 
   DWORD dwOpcode  
) throw( );

Parameters

  • dwOpcode
    A switch that defines the handler operation. For details, see the Remarks.

Remarks

This is the code that the Service Control Manager (SCM) calls to retrieve the status of the service and issue instructions such as stop or pause. The SCM passes an operation code, shown below, to Handler to indicate what the service should do.

Operation code

Meaning

SERVICE_CONTROL_STOP

Stops the service. Override the method CAtlServiceModuleT::OnStop in atlbase.h to change the behavior.

SERVICE_CONTROL_PAUSE

User implemented. Override the empty method CAtlServiceModuleT::OnPause in atlbase.h to pause the service.

SERVICE_CONTROL_CONTINUE

User implemented. Override the empty method CAtlServiceModuleT::OnContinue in atlbase.h to continue the service.

SERVICE_CONTROL_INTERROGATE

User implemented. Override the empty method CAtlServiceModuleT::OnInterrogate in atlbase.h to interrogate the service.

SERVICE_CONTROL_SHUTDOWN

User implemented. Override the empty method CAtlServiceModuleT::OnShutdown in atlbase.h to shutdown the service.

If the operation code isn't recognized, the method CAtlServiceModuleT::OnUnknownRequest is called.

A default ATL-generated service only handles the stop instruction. If the SCM passes the stop instruction, the service tells the SCM that the program is about to stop. The service then calls PostThreadMessage to post a quit message to itself. This terminates the message loop and the service will ultimately close.

Requirements

Header: atlbase.h

See Also

Reference

CAtlServiceModuleT Class