Service Method

Service method connects the main thread of a service process to the service control manager, which causes the thread to become service control dispatcher thread for the calling process. Please, note that the main thread will be blocked till service end.  

BOOL Service(
 void
);


Return Values
  If the method succeeds, the return value is nonzero.
Code Example
 

// m_ServiceAx - Run Service ActiveX Control
// If Run Service ActiveX Control was installed and service is ready to start then launch new 
// service in a main thread
if (m_ServiceAx.get_IsCreate() && (m_ServiceAx.get_CurrentState () == RSA_SERVICE_START_PENDING))
{  
 	// Service method is blocking, therefore if m_ServiceAx.Service() returns TRUE than service 
	// worked out successfully and we may safely close our application, if function returns FALSE
	// than service couldn't start or application was launched not as service.
	if (m_ServiceAx.Service ())
	{        
		Close ();   
	} 
} 


See also

NewThreadService