|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
running app as a service - logoff user shuts down applicationI've set up an application to run as a service using srvany
the application starts fine as a service when my pc is powered up everything stays fine when a user logs on however when a user logs off (with out shuting down) the application ends is there an event or something I can work with to prevent my application (written in vb.net using vs 2005) from ending when the user logs off thanks in advance Rob Hi Rob,
Does your app interact with the desktop? I just have a guess that since there might be no window station available after the user logging off, srvany might have to shut down your application if it is designed to interact with the user (which services should mostly never do). I might also suppose this is a srvany bug, but I have absolutely nothing to prove this - so what you might do is to search for a list of srvany's known issues. Show quote "Rob Latour" <roblat***@rogers.com> wrote in message news:eVNUJlJIGHA.596@TK2MSFTNGP10.phx.gbl... > I've set up an application to run as a service using srvany > > the application starts fine as a service when my pc is powered up > > everything stays fine when a user logs on > > however when a user logs off (with out shuting down) the application ends > > is there an event or something I can work with to prevent my application > (written in vb.net using vs 2005) > from ending when the user logs off > > thanks in advance > > Rob > Hi
Yes my app does interact with the desktop, and the appropriate check box is checked in the service properties window. The research I have done to date seems to indicate my app needs to handle the CTRL_LOGOFF_EVENT but I can't seem to find anything inteligable to says how to go about this espicially in visual basic .net Show quote "Dmytro Lapshyn [MVP]" <x-code@no-spam-please.hotpop.com> wrote in message news:ePYuBIMIGHA.1192@TK2MSFTNGP11.phx.gbl... > Hi Rob, > > Does your app interact with the desktop? I just have a guess that since > there might be no window station available after the user logging off, > srvany might have to shut down your application if it is designed to > interact with the user (which services should mostly never do). > > I might also suppose this is a srvany bug, but I have absolutely nothing > to prove this - so what you might do is to search for a list of srvany's > known issues. > > "Rob Latour" <roblat***@rogers.com> wrote in message > news:eVNUJlJIGHA.596@TK2MSFTNGP10.phx.gbl... >> I've set up an application to run as a service using srvany >> >> the application starts fine as a service when my pc is powered up >> >> everything stays fine when a user logs on >> >> however when a user logs off (with out shuting down) the application ends >> >> is there an event or something I can work with to prevent my application >> (written in vb.net using vs 2005) >> from ending when the user logs off >> >> thanks in advance >> >> Rob >> > > Hi again,
You can use the SetConsoleCtrlHandler function to specify the handler routine. I believe this can be done in .NET (with P/Invoke), and you might want to post a corresponding question to the microsoft.public.dotnet.framework.interop. Unfortunately I never did WinAPI callbacks in .NET so I really can't be very helpful. You might be just fine with declaring the API function with [DllImport] and declaring a delegate corresponding to the handler function's prototype (the return value and the arguments), but it might turn out to be more complex than that. Show quote "Rob Latour" <roblat***@rogers.com> wrote in message news:e$sXCcVIGHA.1132@TK2MSFTNGP10.phx.gbl... > Hi > > Yes my app does interact with the desktop, and the appropriate check box > is checked in the service properties window. > > The research I have done to date seems to indicate my app needs to handle > the CTRL_LOGOFF_EVENT > but I can't seem to find anything inteligable to says how to go about this > espicially in visual basic .net > > > > > > "Dmytro Lapshyn [MVP]" <x-code@no-spam-please.hotpop.com> wrote in message > news:ePYuBIMIGHA.1192@TK2MSFTNGP11.phx.gbl... >> Hi Rob, >> >> Does your app interact with the desktop? I just have a guess that since >> there might be no window station available after the user logging off, >> srvany might have to shut down your application if it is designed to >> interact with the user (which services should mostly never do). >> >> I might also suppose this is a srvany bug, but I have absolutely nothing >> to prove this - so what you might do is to search for a list of srvany's >> known issues. >> >> "Rob Latour" <roblat***@rogers.com> wrote in message >> news:eVNUJlJIGHA.596@TK2MSFTNGP10.phx.gbl... >>> I've set up an application to run as a service using srvany >>> >>> the application starts fine as a service when my pc is powered up >>> >>> everything stays fine when a user logs on >>> >>> however when a user logs off (with out shuting down) the application >>> ends >>> >>> is there an event or something I can work with to prevent my application >>> (written in vb.net using vs 2005) >>> from ending when the user logs off >>> >>> thanks in advance >>> >>> Rob >>> >> >> > > thank you
Show quote "Dmytro Lapshyn [MVP]" <x-code@no-spam-please.hotpop.com> wrote in message news:OQKRH1XIGHA.1424@TK2MSFTNGP12.phx.gbl... > Hi again, > > You can use the SetConsoleCtrlHandler function to specify the handler > routine. I believe this can be done in .NET (with P/Invoke), and you might > want to post a corresponding question to the > microsoft.public.dotnet.framework.interop. > > Unfortunately I never did WinAPI callbacks in .NET so I really can't be > very helpful. You might be just fine with declaring the API function with > [DllImport] and declaring a delegate corresponding to the handler > function's prototype (the return value and the arguments), but it might > turn out to be more complex than that. > > "Rob Latour" <roblat***@rogers.com> wrote in message > news:e$sXCcVIGHA.1132@TK2MSFTNGP10.phx.gbl... >> Hi >> >> Yes my app does interact with the desktop, and the appropriate check box >> is checked in the service properties window. >> >> The research I have done to date seems to indicate my app needs to handle >> the CTRL_LOGOFF_EVENT >> but I can't seem to find anything inteligable to says how to go about >> this espicially in visual basic .net >> >> >> >> >> >> "Dmytro Lapshyn [MVP]" <x-code@no-spam-please.hotpop.com> wrote in >> message news:ePYuBIMIGHA.1192@TK2MSFTNGP11.phx.gbl... >>> Hi Rob, >>> >>> Does your app interact with the desktop? I just have a guess that since >>> there might be no window station available after the user logging off, >>> srvany might have to shut down your application if it is designed to >>> interact with the user (which services should mostly never do). >>> >>> I might also suppose this is a srvany bug, but I have absolutely nothing >>> to prove this - so what you might do is to search for a list of srvany's >>> known issues. >>> >>> "Rob Latour" <roblat***@rogers.com> wrote in message >>> news:eVNUJlJIGHA.596@TK2MSFTNGP10.phx.gbl... >>>> I've set up an application to run as a service using srvany >>>> >>>> the application starts fine as a service when my pc is powered up >>>> >>>> everything stays fine when a user logs on >>>> >>>> however when a user logs off (with out shuting down) the application >>>> ends >>>> >>>> is there an event or something I can work with to prevent my >>>> application >>>> (written in vb.net using vs 2005) >>>> from ending when the user logs off >>>> >>>> thanks in advance >>>> >>>> Rob >>>> >>> >>> >> >> > > |
|||||||||||||||||||||||