service and SetConsoleCtrlHandler

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Jan Bares (jan.bares_at_nospam.nospam)
Date: 10/04/04


Date: Mon, 4 Oct 2004 17:47:07 +0200

Hi,

on my Win2k I have a service running. Inside the service start code I use
SetConsoleCtrlHandler() (this is because the service can also be started as
console process for debugging). I realized that my service is shutdown in
some random time (~hours) due to call to HandlerRoutine() routine. I would
like to know how this can happen. I don't suspect that Windows is sending
Ctrl-C to my service at random time...which program can do that?

Aha, just now I realized, that Windows is most probably calling Ctrl-C to
the console when I log off. It seems like all consoles will get Ctrl-C
during log off...comments?

Jan



Relevant Pages

  • Re: Sending CTRL-C event to console application
    ... cleanly if it sees "CTRL-C" on the console. ... "Only those processes in the group that share the same console as the ... I'm going to try taking a different approach by using a GUI Automation ... WATSUP - Windows Application Test System Using Python ...
    (comp.lang.python)
  • Re: [Windows] Sending CTRL-C event to console application
    ... "Only those processes in the group that share the same console as the calling process receive the signal. ... Maybe you have better luck on a Windows programming group, asking how to send a Ctrl-C event to another process attached to a different console. ...
    (comp.lang.python)
  • Re: Send ctrl-c
    ... | If your app is a console app the console receives the key events and sends ... cntrl-c at the c:\ prompt will just bring you to another prompt and not ... And if you do dir /s and do a ctrl-c, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: AppDomain.CurrentDomain.ProcessExit && CTRL-C
    ... The good news is, if you move to V2.0, ... > We've got a handler on Console now, to catch Ctrl-C, so we can deal with ...
    (microsoft.public.dotnet.framework.clr)
  • RE: AppDomain.CurrentDomain.ProcessExit && CTRL-C
    ... The good news is, if you move to V2.0, ... We've got a handler on Console now, to catch Ctrl-C, so we can deal with ...
    (microsoft.public.dotnet.framework.clr)