Using WINWRAP Functions
The WINWRAP library (WINWRAP.LIB, with the WINWRAP.H header file) contains functions used to create a service from a Windows application without writing your own WinMain function and window message loop. The resulting application will be a Windows NT Server (32-bit) service.
WINWRAP defines a WinMain function that performs the following tasks:
-
Optionally creates a minimized service application icon on the desktop. To implement this function, pass NOTSERV and the name of the service from the Windows NT Registry.
-
Creates an hServiceStopEvent event object used to signal a shutdown of the service. This event object is initialized to FALSE (not signaled). You can get a copy of this event handle by calling the GetServiceStopEvent function.
-
Calls HrServiceStartup if the minimized window and hServiceStopEvent are created successfully. Otherwise it terminates the program.
-
Creates a new thread to run ServiceMain if HrServiceStartup returns TRUE.
-
Processes messages with the message loop.
-
Signals the hServiceStopEvent event object when the service is stopped or Close is selected from the system menu of the minimized service application icon.