Click here to Skip to main content
16,014,662 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: Assertion failed: _pAtlModule == 0 Pin
Christian Bayer12-Oct-08 22:14
Christian Bayer12-Oct-08 22:14 
GeneralRe: Assertion failed: _pAtlModule == 0 Pin
led mike13-Oct-08 6:07
led mike13-Oct-08 6:07 
GeneralRe: Assertion failed: _pAtlModule == 0 Pin
Christian Bayer13-Oct-08 9:40
Christian Bayer13-Oct-08 9:40 
GeneralRe: Assertion failed: _pAtlModule == 0 Pin
led mike13-Oct-08 9:56
led mike13-Oct-08 9:56 
GeneralRe: Assertion failed: _pAtlModule == 0 Pin
Christian Bayer13-Oct-08 12:38
Christian Bayer13-Oct-08 12:38 
QuestionAutomatically Start Windows Service on Startup [modified] Pin
narayanagvs6-Oct-08 22:10
narayanagvs6-Oct-08 22:10 
AnswerRe: Automatically Start Windows Service on Startup Pin
KarstenK6-Oct-08 23:22
mveKarstenK6-Oct-08 23:22 
AnswerRe: Automatically Start Windows Service on Startup Pin
Stuart Dootson6-Oct-08 23:53
professionalStuart Dootson6-Oct-08 23:53 
After the Install method of CAtlServiceModuleT is called, you could use OpenService to get a handle on the service and then ChangeServiceConfig to alter the service's start type to SERVICE_AUTO_START?

Looking in the code, you could override RegisterAppId to do that, as RegisterAppId calls the Install method - you can't just override Install, because it's not virtual - RegisterAppId is the closest method called using a correctly typed object pointer (look for pT->RegisterAppId in AtlBase.h). Something like the code below should work?

HRESULT RegisterAppId(bool bService = false) throw()
{
   HRESULT hBaseRes = CAtlServiceModuleT< CbModule, IDS_SERVICENAME >::RegisterAppId(bService);
   if (SUCCEEDED(hBaseRes) && bService)
   {
      HRESULT hRes = E_FAIL;
      SC_HANDLE hSCM = ::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
      if (hSCM != NULL)
      {
         SC_HANDLE hService = ::OpenService(hSCM, m_szServiceName, SERVICE_CHANGE_CONFIG);
         if (hService != NULL)
         {
            if (::ChangeServiceConfig(hService,
                                      SERVICE_NO_CHANGE, SERVICE_AUTO_START, SERVICE_NO_CHANGE,
                                      NULL, NULL, NULL, NULL, NULL, NULL, NULL))
            {
               hRes = hBaseRes;
            }
            ::CloseServiceHandle(hService);
         }
         ::CloseServiceHandle(hSCM);
      }
      hBaseRes = hRes;
   }
   return hBaseRes;
}

Questionwhy use parenthsis ? Pin
palmer774-Oct-08 17:47
palmer774-Oct-08 17:47 
Answer[Message Deleted] Pin
Steve Echols4-Oct-08 19:41
Steve Echols4-Oct-08 19:41 
GeneralRe: why use parenthsis ? Pin
palmer774-Oct-08 20:59
palmer774-Oct-08 20:59 
AnswerRe: why use parenthsis ? Pin
Michael Dunn5-Oct-08 20:34
sitebuilderMichael Dunn5-Oct-08 20:34 
AnswerRe: why use parenthsis ? Pin
KarstenK6-Oct-08 23:23
mveKarstenK6-Oct-08 23:23 
GeneralRe: why use parenthsis ? Pin
Michael Dunn7-Oct-08 19:51
sitebuilderMichael Dunn7-Oct-08 19:51 
GeneralRe: why use parenthsis ? Pin
KarstenK7-Oct-08 20:31
mveKarstenK7-Oct-08 20:31 
QuestionCCombobox question Pin
monsieur_jj2-Oct-08 21:00
monsieur_jj2-Oct-08 21:00 
AnswerRe: CCombobox question Pin
Ted Szoczei3-Oct-08 16:05
Ted Szoczei3-Oct-08 16:05 
QuestionDialog DoModal fails in win2000 Pin
gaara241-Oct-08 2:44
gaara241-Oct-08 2:44 
AnswerRe: Dialog DoModal fails in win2000 Pin
Stuart Dootson1-Oct-08 7:46
professionalStuart Dootson1-Oct-08 7:46 
GeneralRe: Dialog DoModal fails in win2000 Pin
gaara242-Oct-08 0:08
gaara242-Oct-08 0:08 
GeneralRe: Dialog DoModal fails in win2000 Pin
Stuart Dootson2-Oct-08 7:16
professionalStuart Dootson2-Oct-08 7:16 
QuestionTask Scheduler Pin
brucewayn1-Oct-08 0:11
brucewayn1-Oct-08 0:11 
AnswerRe: Task Scheduler Pin
Stuart Dootson1-Oct-08 7:36
professionalStuart Dootson1-Oct-08 7:36 
QuestionQuestions re. ATL service (EXE) plus ATL simple object Pin
markiemooster30-Sep-08 3:22
markiemooster30-Sep-08 3:22 
AnswerRe: Questions re. ATL service (EXE) plus ATL simple object Pin
led mike30-Sep-08 5:13
led mike30-Sep-08 5:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.