🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #3324

Re: shutdown computer

#3324
From: Mike Collins
Date: Fri, 21 Jul 2006 12:08
34 lines
2155 bytes
It's an API question so, yes - right newsgroup.

Generally for shutting down or restarting a Windows machine you would use 
InitiateSystemShutdown / Ex although i don't think it is compatible with Win 
95 / 98 - MSDN only references Windows 2000 and above.

There is an older api, ExitWindowsEx that should work with 95 / 98.  It 
receives a flag to indicate what 'shutdown' action you want and a reason 
code to indicate why you are shutting down.

bool ExitWindowsEx(UINT uFlag, DWORD dwReason);

the flags for shutting down would be either EWX_SHUTDOWN or EWX_POWEROFF. 
If your code is going to be run on Win2k+ machines as well then you may need 
to adjust the privileges as well.  This is try of InitiateSystemShutdown / 
Ex so i assume it must be true with this api.

See 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shutdown/base/how_to_shut_down_the_system.asp 
for more info...

HTH

Mike C


"Renan" <gulbrrs@gmail.com> wrote in message 
news:44c0bfe7$1@newsgroups.borland.com...
>
> How do I shutdown the computer? (Don't know if it is the right place to 
> post it)
>
> Windows 95 and 98
> Renan 
Technical Details
Message-ID: <44c0c3d1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!news2.volia.net!news.musoftware.de!news.code-werk.net!open-news-network.org!news.soft-gems.net!reader.uucp.at!feeder02.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail
References: <44c0bfe7$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,1a7de0d7fbb609c8
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Mike Collins" <its@TheBottomOfThePost.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <44c0bfe7$1@newsgroups.borland.com>
Subject: Re: shutdown computer
Date: Fri, 21 Jul 2006 13:08:48 +0100
Lines: 36
Organization: SDA Ltd
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.2663
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 88.109.94.144
Message-ID: <44c0c3d1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1153483729 88.109.94.144 (21 Jul 2006 05:08:49 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!news2.volia.net!news.musoftware.de!news.code-werk.net!open-news-network.org!news.soft-gems.net!reader.uucp.at!feeder02.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail