🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.databases.ms-access
Article #245

Re: exit program and log off as xp user

#245
From: New_Entry
Date: Mon, 26 Jan 2004 14:19
44 lines
2897 bytes
> I'm using VB6 and Windows XP. For an user on my computer (my 3 year old
> daughter) I wrote a program in VB. For reasons of security the program
> automaticly starts as she logs in on her user-account.
>
> Now I'm wondering if it's possible to automaticly log off at the moment
the
> VB-program is ended
> I now use a command-button with the "End"-statement, so you return to the
> desktop. Can I use another command or do I need to call an external
command?
> If so, how?

look at  http://www.mentalis.org/tips/tip016.shtml

you can see:

Use the function ExitWindowsEx. This function has two parameters. The first
is one or more flags to instruct windows how to shutdown. These are listed
below along with the declarations. The second part of the function is
reserved, and it set to zero. It is important to unload your application to
help the system to shut down smoothly. The declarations for this function
are below.
Public Const EWX_LOGOFF = 0
Public Const EWX_SHUTDOWN = 1
Public Const EWX_REBOOT = 2
Public Const EWX_FORCE = 4

Declare Function ExitWindowsEx Lib "user32" Alias _
"ExitWindowsEx" (ByVal uFlags As Long, ByVal dwReserved _
As Long) As Long

If you wanted to forcefully reboot the computer use the following code:

t& = ExitWindowsEx(EWX_FORCE OR EWX_REBOOT, 0)



If you wanted to logoff the computer use the following code:

t& = ExitWindowsEx(EWX_LOGOFF, 0)



Bye Luca
Technical Details
Message-ID: <im9Rb.287024$e6.11157328@twister2.libero.it>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.mailgate.org!nntp.infostrada.it!twister2.libero.it.POSTED!not-for-mail
References: <bv33mn$qc5$1@news2.tilbu1.nb.home.nl>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1053fc,3729be0514657520
X-Google-Attributes: gid1053fc,public
X-Google-Thread: f51ba,3729be0514657520
X-Google-Attributes: gidf51ba,public
X-Google-Thread: 110e3b,3729be0514657520
X-Google-Attributes: gid110e3b,public
X-Google-Thread: ff0ac,3729be0514657520
X-Google-Attributes: gidff0ac,public
X-Google-Thread: 10b997,3729be0514657520
X-Google-Attributes: gid10b997,public
X-Google-ArrivalTime: 2004-01-26 06:19:59 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.mailgate.org!nntp.infostrada.it!twister2.libero.it.POSTED!not-for-mail
From: "New_Entry" <l@l.it>
Newsgroups: comp.databases.ms-access,comp.lang.basic.visual.misc,dk.edb.programmering.basic.visual-basic,es.comp.lenguajes.visual-basic,it.comp.lang.visual-basic
References: <bv33mn$qc5$1@news2.tilbu1.nb.home.nl>
Subject: Re: exit program and log off as xp user
Lines: 46
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <im9Rb.287024$e6.11157328@twister2.libero.it>
Date: Mon, 26 Jan 2004 14:19:58 GMT
NNTP-Posting-Host: 151.44.23.183
X-Complaints-To: abuse@net24.it
X-Trace: twister2.libero.it 1075126798 151.44.23.183 (Mon, 26 Jan 2004 15:19:58 MET)
NNTP-Posting-Date: Mon, 26 Jan 2004 15:19:58 MET
Organization: [Infostrada]