Click here to Skip to main content
15,909,325 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Calling global function causing linking error. Pin
Comp_Users10-Feb-09 18:36
Comp_Users10-Feb-09 18:36 
QuestionCalling C# DLL into core C++ Console application [modified] Pin
PankajB10-Feb-09 2:09
PankajB10-Feb-09 2:09 
AnswerRe: Calling C# DLL into core C++ Console application Pin
led mike10-Feb-09 4:30
led mike10-Feb-09 4:30 
AnswerRe: Calling C# DLL into core C++ Console application Pin
Eytukan10-Feb-09 8:43
Eytukan10-Feb-09 8:43 
QuestionHow to update single view Pin
KASR110-Feb-09 2:04
KASR110-Feb-09 2:04 
AnswerRe: How to update single view Pin
Maximilien10-Feb-09 2:43
Maximilien10-Feb-09 2:43 
AnswerRe: How to update single view Pin
David Crow10-Feb-09 3:00
David Crow10-Feb-09 3:00 
QuestionWinAPI Service StartServiceCtrlDispatcher gives Error-Code "1063" Pin
Harry_D10-Feb-09 0:37
Harry_D10-Feb-09 0:37 
Hello,

my Name is Harry Diel and I’m a Software-Engineer (Development) here in Germany.
A couple of years ago (2000-2005) I developed for a Medical-Assosiation under Windows XP and Server 2003 with MFC und Visual C 6.0 a LAN-Manager System with some RPC-programs, which where running as services on several clients, in a large System-LAN environment with more than 1500 installed workstations (NT/XP), Printern and over 200 Servers with Windows 2003 / NT. everything was OK, until now the first Windows Vista will be used.

The Time has come to upgrade to Windows Vista !!!!
Now I updated my C-Programs to Visual C++ 9.0 and VS 2008. The functionalities of the program were still the same, nothing changed. But now I get from the StartServiceCtrlDispatcher Function always the Error-Code “1063” =

ERROR_FAILED_SERVICE_CONTROLLER_CONNECT. (Only when the service starts on Windows Vista).

I need help, what can I do. I tried everything, but nothing works and helps realy.

Enclosed you will find a piece of my Program-Code of the C++ program, when the service should start working. But it stops!!!!

Maybe you can send me an example for Windows Vista how it would work.

I am waiting for an answer. Thank you.

regards

harry Diel,
47475 Kamp-Lintfort, Germany
E-Mail: harry.diel@t-online.de

1 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 int Win_RemComServiceMain (void)
3 { ///////////////////////////////////////////////////////////////////////////////
4 sprintf (szOpenFName,"%s","C:\\Temp\\RemComLogDatei.log");
5 hOpenF = CreateFile (szOpenFName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ,
6 NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
7
8 if (hOpenF == (HANDLE)ERROR)
9 { hOpenF = NULL;
10 }
11 ///////////////////////////////////////////////////////////////////////////////
12 _GetDateAndTime();
13 sprintf(sWrkBuff,"%.6s | %s\tWin_RemComServiceMain\t: LogFile gestartet.%s",ActDatum, sCurrTime, EOR);
14 WriteErrorText_2 (sWrkBuff);
15 ///////////////////////////////////////////////////////////////////////////////
16 // Register the service control handler
17 g_hstatus = RegisterServiceCtrlHandler(REMC_SERVICENAME, ServiceCtrl);
18 if (g_hstatus == 0)
19 return FALSE;
20
21 // Setzen einiger Service-Standard Status-Values
22 g_ServiceMode = TRUE;
23 SetProcessShutdownParameters(0x100, 0);
24
25 // Erstelle einen Service Tabellen-Eintrag
26 SERVICE_TABLE_ENTRY dispatchTable[] =
27 { {REMC_SERVICENAME, (LPSERVICE_MAIN_FUNCTION) RemComDoService},
28 {NULL, NULL}
29 };
30 ///////////////////////////////////////////////////////////////////////////////
31 _GetDateAndTime();
32 sprintf(sWrkBuff,"%.6s | %s\tStartServiceCtrlDispatcher\t%s%s",ActDatum, sCurrTime, REMC_SERVICENAME, EOR);
33 WriteErrorText_2 (sWrkBuff);
34
35 // Aufrufen des Service-Control-Dispatcher mit unserem Tabellen-Eintrag
36 bRetc = StartServiceCtrlDispatcher(dispatchTable);
37 if (bRetc == TRUE)
38 { return TRUE;
39 }
40 SvcError = GetLastError();
41 if (SvcError == ERROR_SERVICE_ALREADY_RUNNING)
42 return TRUE;
43 else
44 { _GetDateAndTime();
45 sprintf(sWrkBuff,"%.6s | %s\tStartServiceCtrlDispatcher\tFehler = %d%s",ActDatum, sCurrTime, SvcError, EOR);
46 WriteErrorText_2 (sWrkBuff);
47 return FALSE;
48 }
49 }
50
51 ///////////////////////////////////////////////////////////////////////////////////
52 // RemComService Main-Routines
53 ///////////////////////////////////////////////////////////////////////////////////
54 BOOL WINAPI RemComDoService (DWORD argc, char **argv)
55 {
56 // Setzen einiger Service-Standard Status-Values
57 g_srvstatus.dwServiceType = SERVICE_WIN32 | SERVICE_INTERACTIVE_PROCESS;
58 g_srvstatus.dwServiceSpecificExitCode = 0;
59 // Give this status to the SCM
60
61 if (!ReportStatus (SERVICE_START_PENDING, NO_ERROR, 15000))
62 { ReportStatus (SERVICE_STOPPED, g_error, 0);
63 return FALSE;
64 }
65
66 hRemCThread = CreateThread (&SecAttributes, NULL,
67 (LPTHREAD_START_ROUTINE) RemComServiceThread,
68 NULL,
69 NULL,
70 &dwThreadId);
71 ///////////////////////////////////////////////////////////////////////////////
72 _GetDateAndTime();
73 sprintf(sWrkBuff,"%.6s | %s\tRemComDoService\tCreateThread OK.%s",ActDatum, sCurrTime, EOR);
74 WriteErrorText_2 (sWrkBuff);
75 return TRUE;
76 }
77
78 ///////////////////////////////////////////////////////////////////////////////////
79 // Service Start-Routine - Thread that calls WinVNCAppMain
80 ///////////////////////////////////////////////////////////////////////////////////
81 BOOL RemComServiceThread (void *arg)
82 {
83 g_servicethread = GetCurrentThreadId();
84
85 bRetc = ReportStatus (SERVICE_RUNNING, NO_ERROR, 0);
86 if (bRetc != TRUE)
87 return FALSE;
88
89 ///////////////////////////////////////////////////////////////////////////////
90 _GetDateAndTime();
91 sprintf(sWrkBuff,"%.6s | %s\tRemComServiceThread\tgestartet: Service_Running -> Call DoModal()%s",ActDatum, sCurrTime, EOR);
92 WriteErrorText_2 (sWrkBuff);
93
94 // The Service should start the Dialog !
95 AfxEnableControlContainer();
96 pRemCService->DoModal();
97
98 // Wir laufen nicht mehr ....
99 g_servicethread = NULL;
100
101 ReportStatus (SERVICE_STOPPED, g_error, 0);
102 return TRUE;
103 }
104
105 ///////////////////////////////////////////////////////////////////////////////
106 ///////////////////////////////////////////////////////////////////////////////
AnswerRe: WinAPI Service StartServiceCtrlDispatcher gives Error-Code "1063" [modified] Pin
_AnsHUMAN_ 10-Feb-09 0:48
_AnsHUMAN_ 10-Feb-09 0:48 
GeneralRe: WinAPI Service StartServiceCtrlDispatcher gives Error-Code "1063" Pin
Harry_D10-Feb-09 6:21
Harry_D10-Feb-09 6:21 
AnswerRe: WinAPI Service StartServiceCtrlDispatcher gives Error-Code "1063" Pin
BukeMan6-Jul-11 0:08
BukeMan6-Jul-11 0:08 
QuestionHow to add and retrive the LPARAM value from CTreeCtrl? Pin
mikert_20089-Feb-09 23:22
mikert_20089-Feb-09 23:22 
AnswerRe: How to add and retrive the LPARAM value from CTreeCtrl? Pin
CPallini9-Feb-09 23:44
mveCPallini9-Feb-09 23:44 
GeneralRe: How to add and retrive the LPARAM value from CTreeCtrl? Pin
mikert_200810-Feb-09 0:01
mikert_200810-Feb-09 0:01 
GeneralRe: How to add and retrive the LPARAM value from CTreeCtrl? Pin
CPallini10-Feb-09 0:37
mveCPallini10-Feb-09 0:37 
AnswerRe: How to add and retrive the LPARAM value from CTreeCtrl? Pin
Code-o-mat10-Feb-09 0:37
Code-o-mat10-Feb-09 0:37 
QuestionAnimated (*.ani) cursor not showing Pin
josip cagalj9-Feb-09 22:53
josip cagalj9-Feb-09 22:53 
AnswerRe: Animated (*.ani) cursor not showing Pin
josip cagalj9-Feb-09 22:59
josip cagalj9-Feb-09 22:59 
GeneralRe: Animated (*.ani) cursor not showing Pin
josip cagalj10-Feb-09 0:55
josip cagalj10-Feb-09 0:55 
GeneralRe: Animated (*.ani) cursor not showing Pin
josip cagalj12-Feb-09 22:36
josip cagalj12-Feb-09 22:36 
GeneralRe: Animated (*.ani) cursor not showing Pin
josip cagalj12-Feb-09 22:46
josip cagalj12-Feb-09 22:46 
Questionideas for database to use... Pin
Thilek9-Feb-09 22:34
Thilek9-Feb-09 22:34 
AnswerRe: ideas for database to use... Pin
Eytukan9-Feb-09 22:37
Eytukan9-Feb-09 22:37 
GeneralRe: ideas for database to use... Pin
Thilek10-Feb-09 0:23
Thilek10-Feb-09 0:23 
GeneralRe: ideas for database to use... Pin
Thilek10-Feb-09 0:29
Thilek10-Feb-09 0:29 

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.