Home All Groups Group Topic Archive Search About

Looking for a way to call LogOff and Shutdown.

Author
28 Feb 2007 7:14 PM
Kardon Coupé
Dear All,

I've setup up an account on my Domain to have a pure internet user, like a
kiosk you would see in a internet cafe, etc....I've locked everything down,
but I need a way to allow the user to log off or shutdown the machine (but I
don't want to give access to start menu, hence desabling the Windows Keys),
I was thinking of writting a little VB App (keeping the form on the top of
the screen, locked to the bottom right hand corner or something) with "Log
Off" or "Shutdown" buttons on it?

Can logoff and/or shutdown be called from VB?

Hope someone can help..

Regards
Paul.

Author
28 Feb 2007 8:13 PM
Bob Butler
Show quote Hide quote
"Kardon Coupé" <prefer.to@readon.newsgroups> wrote in message
news:uxyFyy2WHHA.4632@TK2MSFTNGP04.phx.gbl
> Dear All,
>
> I've setup up an account on my Domain to have a pure internet user,
> like a kiosk you would see in a internet cafe, etc....I've locked
> everything down, but I need a way to allow the user to log off or
> shutdown the machine (but I don't want to give access to start menu,
> hence desabling the Windows Keys), I was thinking of writting a
> little VB App (keeping the form on the top of the screen, locked to
> the bottom right hand corner or something) with "Log Off" or
> "Shutdown" buttons on it?
>
> Can logoff and/or shutdown be called from VB?

The ExitWindowsEx API call -- search around groups.google.com because there
are other calls you need to use first to activate the privileges needed to
call that.

--
Reply to the group so all can participate
VB.Net: "Fool me once..."
Author
1 Mar 2007 4:28 PM
Darhl Thomason
Show quote Hide quote
"Bob Butler" <tiredofit@nospam.ever> wrote in message
news:ub5CkT3WHHA.4076@TK2MSFTNGP05.phx.gbl...
> "Kardon Coupé" <prefer.to@readon.newsgroups> wrote in message
> news:uxyFyy2WHHA.4632@TK2MSFTNGP04.phx.gbl
>> Dear All,
>>
>> I've setup up an account on my Domain to have a pure internet user,
>> like a kiosk you would see in a internet cafe, etc....I've locked
>> everything down, but I need a way to allow the user to log off or
>> shutdown the machine (but I don't want to give access to start menu,
>> hence desabling the Windows Keys), I was thinking of writting a
>> little VB App (keeping the form on the top of the screen, locked to
>> the bottom right hand corner or something) with "Log Off" or
>> "Shutdown" buttons on it?
>>
>> Can logoff and/or shutdown be called from VB?
>
> The ExitWindowsEx API call -- search around groups.google.com because
> there
> are other calls you need to use first to activate the privileges needed to
> call that.
>
> --
> Reply to the group so all can participate
> VB.Net: "Fool me once..."
>

You could also shell out to the shutdown command.

Reboot = "shutdown -r -f -t 00"
(-r = reboot, -f = force unresponding apps to end, -t 00 = time to delay
before executing)
Shutdown = "shutdown -s -f -t 00"
(-s = shutdown)
Logoff = "shutdown -l -f -t 00"
(-l = logoff)

You can even shell to "shutdown -i" which brings up the gui version of the
app.

Type "shutdown" at a command prompt and it will tell you all the switches
and what they do.

d
Author
1 Mar 2007 4:32 PM
Bob Butler
"Darhl Thomason" <darhlt@papamurphys.nospamplease.com> wrote in message
news:eD1Jm6BXHHA.388@TK2MSFTNGP04.phx.gbl
> You could also shell out to the shutdown command.

Just realize that you are relying on an external component that may or may
not be present.  The code for doing this isn't that hard and numerous
examples exist so it's better IMO to keep it under your own control.

--
Reply to the group so all can participate
VB.Net: "Fool me once..."
Author
1 Mar 2007 4:54 PM
Darhl Thomason
"Bob Butler" <tiredofit@nospam.ever> wrote in message
news:uaCQ88BXHHA.1764@TK2MSFTNGP04.phx.gbl...
> Just realize that you are relying on an external component that may or may
> not be present.  The code for doing this isn't that hard and numerous
> examples exist so it's better IMO to keep it under your own control.
>
> --
> Reply to the group so all can participate
> VB.Net: "Fool me once..."
>

Absolutely!  Just offering up another solution/possibility.

FWIW shutdown.exe is a Windows command that has been around as part of the
OS for years.

d
Author
1 Mar 2007 6:41 PM
Karl E. Peterson
Darhl Thomason <darhlt@papamurphys.nospamplease.com> wrote:
> "Bob Butler" <tiredofit@nospam.ever> wrote in message
> news:uaCQ88BXHHA.1764@TK2MSFTNGP04.phx.gbl...
>> Just realize that you are relying on an external component that may or may
>> not be present.  The code for doing this isn't that hard and numerous
>> examples exist so it's better IMO to keep it under your own control.
>
> Absolutely!  Just offering up another solution/possibility.
>
> FWIW shutdown.exe is a Windows command that has been around as part of the
> OS for years.

Eh?  Afaik, it's been part of the Resource Kit for years.  Not any sort of standard
install.
--
..NET: It's About Trust!
http://vfred.mvps.org
Author
1 Mar 2007 7:22 PM
Bob Butler
Show quote Hide quote
"Karl E. Peterson" <k***@mvps.org> wrote in message
news:OQMs5EDXHHA.3332@TK2MSFTNGP04.phx.gbl
> Darhl Thomason <darhlt@papamurphys.nospamplease.com> wrote:
>> "Bob Butler" <tiredofit@nospam.ever> wrote in message
>> news:uaCQ88BXHHA.1764@TK2MSFTNGP04.phx.gbl...
>>> Just realize that you are relying on an external component that may
>>> or may not be present.  The code for doing this isn't that hard and
>>> numerous examples exist so it's better IMO to keep it under your
>>> own control.
>>
>> Absolutely!  Just offering up another solution/possibility.
>>
>> FWIW shutdown.exe is a Windows command that has been around as part
>> of the OS for years.
>
> Eh?  Afaik, it's been part of the Resource Kit for years.  Not any
> sort of standard install.

That's what I thought.  I needed it for a Win2K system recently and had to
hunt it down.

--
Reply to the group so all can participate
VB.Net: "Fool me once..."
Author
1 Mar 2007 7:48 PM
Karl E. Peterson
Bob Butler <tiredofit@nospam.ever> wrote:
Show quoteHide quote
> "Karl E. Peterson" <k***@mvps.org> wrote in message
> news:OQMs5EDXHHA.3332@TK2MSFTNGP04.phx.gbl
>> Darhl Thomason <darhlt@papamurphys.nospamplease.com> wrote:
>>> "Bob Butler" <tiredofit@nospam.ever> wrote in message
>>> news:uaCQ88BXHHA.1764@TK2MSFTNGP04.phx.gbl...
>>>> Just realize that you are relying on an external component that may
>>>> or may not be present.  The code for doing this isn't that hard and
>>>> numerous examples exist so it's better IMO to keep it under your
>>>> own control.
>>>
>>> Absolutely!  Just offering up another solution/possibility.
>>>
>>> FWIW shutdown.exe is a Windows command that has been around as part
>>> of the OS for years.
>>
>> Eh?  Afaik, it's been part of the Resource Kit for years.  Not any
>> sort of standard install.
>
> That's what I thought.  I needed it for a Win2K system recently and had to
> hunt it down.

Been there, yep!
--
..NET: It's About Trust!
http://vfred.mvps.org
Author
2 Mar 2007 5:42 PM
Darhl Thomason
>>> Eh?  Afaik, it's been part of the Resource Kit for years.  Not any
>>> sort of standard install.

Hmm, it's entirely possible that I've had the RK installed with previous
OS's, but I know that the RK is not installed on my XP box, nor any of the
1000 XP boxes I work with...

In any case, it's a great utility.

d
Author
2 Mar 2007 8:01 PM
Jeff Johnson
"Karl E. Peterson" <k***@mvps.org> wrote in message
news:OQMs5EDXHHA.3332@TK2MSFTNGP04.phx.gbl...

>> FWIW shutdown.exe is a Windows command that has been around as part of
>> the
>> OS for years.
>
> Eh?  Afaik, it's been part of the Resource Kit for years.  Not any sort of
> standard install.

Well, it came automatically with XP, and XP has technically been around for
YEARS, so there you go. Of course, the problem was Darhl's use of the phrase
"THE OS," as if Windows has only one version....
Author
2 Mar 2007 9:52 PM
Darhl Thomason
"Jeff Johnson" <i.get@enough.spam> wrote in message
news:OxprKWQXHHA.4908@TK2MSFTNGP06.phx.gbl...
>
> Well, it came automatically with XP, and XP has technically been around
> for YEARS, so there you go. Of course, the problem was Darhl's use of the
> phrase "THE OS," as if Windows has only one version....
>

Yeah!  What he said ;-)

(Thanks Jeff!)

d
Author
5 Mar 2007 10:41 PM
Karl E. Peterson
Jeff Johnson <i.get@enough.spam> wrote:
> "Karl E. Peterson" <k***@mvps.org> wrote in message
> news:OQMs5EDXHHA.3332@TK2MSFTNGP04.phx.gbl...
>
>>> FWIW shutdown.exe is a Windows command that has been around as part of
>>> the OS for years.
>>
>> Eh?  Afaik, it's been part of the Resource Kit for years.  Not any sort of
>> standard install.
>
> Well, it came automatically with XP, and XP has technically been around for
> YEARS, so there you go.

Huh.  Well, I definitely recall having to install it on some XP boxes.  But I see
that it's definitely in the "clean" SP2 VM I have here.  I'll be darned...  Whoops!
I see I also have the RK installed on that one.  Hmmmmm, well, nothing definitive
yet.
--
..NET: It's About Trust!
http://vfred.mvps.org