#134258 - 2005-02-22 02:28 AM
Detecting a log off
|
Bjoern
Fresh Scripter
Registered: 2005-02-20
Posts: 9
|
Hi guys ! I got such a good responce the last time I posted something here, that I might as well try again... 
I have a script that is running hidden while the user is logged in. Now, this works perfect, but of course, on a WinXP/2k machine, if you log off and have any programs running, the "End program" dialogbox pops up...
Are there any way, either by using a built-in kix-fuction, COM-automated "thing", external programs or anything else to detect when the user logs off/shuts down ?
|
|
Top
|
|
|
|
#134260 - 2005-02-22 03:05 AM
Re: Detecting a log off
|
Bjoern
Fresh Scripter
Registered: 2005-02-20
Posts: 9
|
Well... It starts as a logonscript, but instead of quitting, it hides, to be in the background and detect user actions, log data, and perform operations decided by the sysadmin.
The mian purpose is to change the number in my logfile, which shows "Computers currently in use". When the person logs off or shuts down, it changes by number by -1.
Any solutions ??
|
|
Top
|
|
|
|
#134262 - 2005-02-22 03:34 AM
Re: Detecting a log off
|
Bjoern
Fresh Scripter
Registered: 2005-02-20
Posts: 9
|
Uhm... Let me clarify the point a little bit...
It's not just the counter that is important, but the whole thing with the Kix running in the background to perform several other operations too, based on user actions.
Once again; Does anyone have a solution on how to detect when the user logs off/shuts down ? I need the kixscript that is already running to perform an operation when the user logs off/shuts down.
I'll probably go with the logoff-script if I can't find any better way, even though it's not a very good solution in my case...
|
|
Top
|
|
|
|
#134264 - 2005-02-22 05:11 AM
Re: Detecting a log off
|
Bjoern
Fresh Scripter
Registered: 2005-02-20
Posts: 9
|
Heh... I sounded slightly short in the last reply there... Sorry... Didn't quite mean to make it sound like I'm angry... 
Well... The whole application is two things... A logon script, and a control panel for the master computer where I am. The control panel perform operations like kick off user, send/receive messages, read computer status (in use or not), run apps and more snacks like that (I'll explain further if needed).
The way I have done this (it might be a long way around, but at least it's my way) is to save information from the master computer, to a global INI-file, found in the NETLOGON-folder. When the KIX-application running hidden on the workstation detects a variable change in the proper place of the INI-file, it runs the desired action, like kick off (even though I easily could have done this with ShutDown()) and also the functions mentioned above, like send/receive messages.
I know there's a lot of programs like this already out there, but I'm just making one to get better in Kix and programming...
I just need a way to figure out how to detect when the user logs off or shuts down the computer. All suggestions are taken with a great THANK YOU in a desperate moment (like this!)
|
|
Top
|
|
|
|
#134266 - 2005-02-22 08:30 AM
Re: Detecting a log off
|
Bjoern
Fresh Scripter
Registered: 2005-02-20
Posts: 9
|
Yeah, that's a good solution too, but not really what I'm asking for... 
I hate being this picky  Thanks anyways though
|
|
Top
|
|
|
|
#134268 - 2005-02-22 10:28 AM
Re: Detecting a log off
|
ShaneEP
MM club member
   
Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
|
You could try adding...
Code:
$null = WriteValue("HKCU\Control Panel\Desktop","AutoEndTasks","1",REG_SZ)
to the beginning of your login script. This doesnt help with the 'detecting logoff' problem, but i believe it should get rid of the prompt asking to end the process.
|
|
Top
|
|
|
|
#134269 - 2005-02-22 04:46 PM
Re: Detecting a log off
|
Bjoern
Fresh Scripter
Registered: 2005-02-20
Posts: 9
|
Hey, thanks ! I'll add that to my script, because that gets rid of the "End Application" problem.  The service-solution works too !! Thanks, guys 
Still having that detecting problem, though...
|
|
Top
|
|
|
|
#134271 - 2005-02-24 10:38 PM
Re: Detecting a log off
|
Bjoern
Fresh Scripter
Registered: 2005-02-20
Posts: 9
|
Sounds cool with that KixForms idea ! I'll look into that! It's a school... And beleive me... In this school we need it!
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 1607 anonymous users online.
|
|
|