Figure 2: Implementation of WinMain function in LoadBal.cpp

extern "C" int WINAPI 
_tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, 
    LPTSTR lpCmdLine, int /*nShowCmd*/)
{
    ...

    _Module.m_bService = FALSE;
    if (lRes == ERROR_SUCCESS)
        _Module.m_bService = TRUE;

    //run the start up routine
    if (FALSE == CObjMill::StartUp()) {
        //startup failed, so quit
        return _Module.m_status.dwWin32ExitCode;
    };

    _Module.Start();

    // clean up
    CObjMill::CleanUp();

    // When we get here, the service has been stopped
    return _Module.m_status.dwWin32ExitCode;
}