Page 1 of 1
Logging Off/ Logging Out / Shutdown
Posted: Thu Aug 26, 2010 2:13 am
by nassausky
I am trying to create a time management software for PC's at my library and was looking for an example or info on how to have an HMG application automatically logout at a certain time but the timing shouldn't be a problem. The tough part is to find the xbase code or example to actually do the logout or shutdown.
Thanks!
Re: Logging Off/ Logging Out / Shutdown
Posted: Thu Aug 26, 2010 5:25 am
by mol
I think you can use windows shutdown with -l option:
execute file "shutdown.exe -l"
which is placed in windows\system32 folder by default.
Re: Logging Off/ Logging Out / Shutdown
Posted: Thu Aug 26, 2010 4:00 pm
by jparada
Hi,
A little example:
Code: Select all
#include "hmg.ch"
Function Main
DEFINE WINDOW frmMain ;
AT 0,0 ;
WIDTH 400 ;
HEIGHT 400 ;
TITLE 'ShutDown' ;
MAIN
DEFINE BUTTON btnShutDown
ROW 200
COL 40
CAPTION "ShutDown!!! - WARNING"
ACTION { ShellExecute( 0, "Open", "C:\Windows\System32\ShutDown.exe", " -s -t 0", 0, 1 ) }
WIDTH 160
HEIGHT 40
END BUTTON
END WINDOW
ACTIVATE WINDOW frmMain
Return
I tested on Windows Vista and it worked fine,
please be careful!!!
Here you have a link for more information
http://www.computerhope.com/shutdown.htm
HTH
Best Regards
Javier
Re: Logging Off/ Logging Out / Shutdown
Posted: Thu Aug 26, 2010 6:26 pm
by nassausky
Oh excellent I will try that out today or tomorrow
Thank you very much.