Click here to Skip to main content
15,897,315 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Print the program's source code Pin
donaldGuy22-May-05 10:58
donaldGuy22-May-05 10:58 
GeneralRe: Print the program's source code Pin
Christian Graus22-May-05 15:02
protectorChristian Graus22-May-05 15:02 
GeneralRe: Print the program's source code Pin
David Crow23-May-05 2:44
David Crow23-May-05 2:44 
GeneralRunning at set times Pin
Member 66746821-May-05 19:54
Member 66746821-May-05 19:54 
GeneralRe: Running at set times Pin
Trollslayer21-May-05 21:48
mentorTrollslayer21-May-05 21:48 
GeneralRe: Running at set times Pin
Blake V. Miller22-May-05 2:21
Blake V. Miller22-May-05 2:21 
GeneralRe: Running at set times Pin
David Crow23-May-05 2:46
David Crow23-May-05 2:46 
GeneralInvalid handle issue for a Service application while using GenerateConsoleCtrlEvent Pin
jiju_m_jiju21-May-05 19:39
sussjiju_m_jiju21-May-05 19:39 
Invalid handle issue for a Service application while using GenerateConsoleCtrlEvent

Description:

I have a non GUI application.

I have an issue with GenerateConsoleCtrlEvent while running the application in Service mode.

The following code raised an "invalid handle" error (GetLastError code 6) while running in Service mode:

BOOL res = GenerateConsoleCtrlEvent( CTRL_BREAK_EVENT, dwProcessId );

The same works without any problem when it is run as a console application.


My architecture is something as follows:

I have a partnet process, which creates multiple child processes for executing specific jobs.

In normal case, the child processes finish their jobs and exit gracefully. But some times (e.g. a shutdown), the parent process want to notify the child process to terminate immediately using CTRL_BREAK_EVENT (GenerateConsoleCtrlEvent).

Further, I give the creation flag CREATE_NEW_PROCESS_GROUP while creating the child process.

The child process is a simple console appliction and which has a console handler.

The annoying part is, the above mechanism works smoothly when i run the mother process as console appliction.

I am not sure if this is the case but, my hunch is that the problem occurs because the Service does not have a console (when running as a service). But how do I give console to the Service application and hide it?


Please help me find a way,

Thanks and regards,
GeneralPrint preview Pin
Anonymous21-May-05 15:54
Anonymous21-May-05 15:54 
GeneralDevice contexts Pin
Anonymous21-May-05 15:43
Anonymous21-May-05 15:43 
GeneralRe: Device contexts Pin
Blake V. Miller21-May-05 18:20
Blake V. Miller21-May-05 18:20 
GeneralDynamic splliter windows Pin
Anonymous21-May-05 15:01
Anonymous21-May-05 15:01 
GeneralSerialization Pin
Anonymous21-May-05 15:00
Anonymous21-May-05 15:00 
GeneralRe: Serialization Pin
Tom Archer21-May-05 15:13
Tom Archer21-May-05 15:13 
GeneralRe: Serialization Pin
Ravi Bhavnani22-May-05 5:50
professionalRavi Bhavnani22-May-05 5:50 
GeneralRe: Serialization Pin
David Crow23-May-05 2:48
David Crow23-May-05 2:48 
GeneralRestoring Multiple Toolbars Pin
Ron Ritchie21-May-05 12:58
Ron Ritchie21-May-05 12:58 
GeneralRe: Restoring Multiple Toolbars Pin
Jack Puppy21-May-05 20:44
Jack Puppy21-May-05 20:44 
GeneralRe: Restoring Multiple Toolbars Pin
Ron Ritchie25-May-05 11:52
Ron Ritchie25-May-05 11:52 
GeneralRun in memory Pin
Dennis L21-May-05 11:50
Dennis L21-May-05 11:50 
GeneralRe: Run in memory Pin
Alexander M.,21-May-05 12:55
Alexander M.,21-May-05 12:55 
GeneralRe: Run in memory Pin
autodebug21-May-05 17:20
autodebug21-May-05 17:20 
GeneralWindow Hook overhead Pin
peterchen21-May-05 10:48
peterchen21-May-05 10:48 
Generalturning images Pin
SuperTank21-May-05 8:22
SuperTank21-May-05 8:22 
Generalname of the node Pin
rgchezhian21-May-05 7:05
rgchezhian21-May-05 7:05 

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.