Is there anyone here know how to catch window Log-Off message event,
My situation is, i have a c++ aplication, which is runing as service
but the problem is when the user Log-off, the application it self was automatically terminated/shut Off
(My objective here is to keep the aplication stay on line/active regardless of any user activity such as Log-off)
Just for your info, the checkBox field "allow service to interact with desktop" is on checked/active mode,
That checkBox field is a configuration for window service
so my question is,
1)what is the name for the window log-off message event?
2)how to catch/capture that message event
I'm not realy sure why the service application is terminating, during log-off
But one thing for sure is, this service application was not crashing
just for your info this service application was created by mySelf,
Perhaps that's the main reason why the service application is terminating,
I already go through other service application which is came from Windows,
the outcome is perfect the service never goes off during Log-off...
By the way what is SCM? what is stand for?
Yesterday i googled and searching, to solve this issue
and the conclusion is:
when the computer is log-off,
the WINDOWS (in my case window xp) will send a windowMessageEvent such as WM_ENDSESSION and WM_QUERYENDSESSION to any runing applicaton,
The purpose for eventMessage sending is to shutdown all the runing application,
But the good thing is on that application we can create a windowMessageEventHandle to reprocess the windowMessagEvent received from window
So in other word we able to keep the application runing,even though the application received a log-off mesageEvent from windows
I already try that on the normal application(NOT RUNING AS SERVICE),
and the result is log-off activity was canceled
But when i implement this mechanism on the service appication
the outcome was completely diffrent (the service application terminated)
Actualy i got a feeling,
perhaps this all related to WinApi programming but i'm not sure for that either
I'm afraid i got a wrong concept on that matter since the beginning,
If you have any idea on this issue such as what kind of WinApi function to used
or perhaps you have any reference document
please let me know....
Oh, it's not a service in the sense used in Windows development. It's just a regular process that runs in the background, isn't it? Yeah, user processes are killed by the OS when the user who started them logs out. There's no way around it.
If you want it to run independent of the user, you'll have to write it as a service, with everything that entails. Basically, it'll just be driver started by the kernel. You'll probably have to write it in C (I'm not sure exactly when C++ is allowed in driver code. I know kernel drivers must be written in C, but user drivers may allow C++), and compile it with the DDK.
It's pretty hairy stuff and I would avoid it if at all possible.
Dear helios,
It is services application, which i'm talking about
I can see my application stated/registered on the window service controler
this window service you can find it by presing [start>control panel>administrative tools > services]
I can start/stop my application by pressing "start the service" or "stop the services"
but when i log-off and then log-on again,
my application which is registered on the window service automatically stated as STOPPED
That's pretty weird for me,
coz according to the rule if any application registerd as service it will keep running even though there is a log-off activity
But in my case it is automatically shut down
SCM was my shorthand for the Service Control Manager. I'm not sure how you managed to write a service and not be familiar with it.
The SCM writes to the Application Event Log. You can check there to see if it is stopping your service, if indeed you do have a Windows Service.
Even if a Service runs under your account, it is in a distinctly different environment from the logoned on session. One should not affect the other at all, but I quess that's why you asked the question.
You may need to post some of your code if there are no logs to investigate.