 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jesper Guest
|
Posted: Sat Jun 28, 2003 8:02 pm Post subject: code for shutting down windows |
|
|
Does anyone know some c++ code for shutting down windows?
I want to write a program using borland c++ builder to shut down windows.
--
|
|
| Back to top |
|
 |
Patrick Kowalzick Guest
|
Posted: Sat Jun 28, 2003 8:18 pm Post subject: Re: code for shutting down windows |
|
|
Is there some code to shut it down forever ?
Patrick
"Jesper" <jesper (AT) i-dont-want-spam (DOT) oek.dk> schrieb im Newsbeitrag
news:bdks63$dcl$1 (AT) news (DOT) net.uni-c.dk...
| Quote: | Does anyone know some c++ code for shutting down windows?
I want to write a program using borland c++ builder to shut down windows.
--
|
|
|
| Back to top |
|
 |
Corey Murtagh Guest
|
Posted: Sat Jun 28, 2003 8:36 pm Post subject: Re: [OT] code for shutting down windows |
|
|
Jesper wrote:
| Quote: | Does anyone know some c++ code for shutting down windows?
I want to write a program using borland c++ builder to shut down windows.
|
The C++ language has no concept of "shutting down windows". Your
question is off topic for this newsgroup. You should ask questions like
this in a newsgroup which deals with Windows.
However, since I do actually know the answer:
ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCEIFHUNG, -1);
Or if you want the system logs on WinXP to show something meaningful:
ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCEIFHUNG, SHTDN_REASON_MAJOR_OTHER |
SHTDN_REASON_MINOR_OTHER | SHTDN_REASON_FLAG_PLANNED);
--
Corey Murtagh
The Electric Monk
"Quidquid latine dictum sit, altum viditur!"
|
|
| Back to top |
|
 |
Jonathan Clements Guest
|
Posted: Sun Jun 29, 2003 6:04 pm Post subject: Re: code for shutting down windows |
|
|
We can only hope... (I'm stuck with it though!)
"Patrick Kowalzick" <patrick.kowalzick (AT) web (DOT) de> wrote
| Quote: | Is there some code to shut it down forever ?
Patrick
"Jesper" <jesper (AT) i-dont-want-spam (DOT) oek.dk> schrieb im Newsbeitrag
news:bdks63$dcl$1 (AT) news (DOT) net.uni-c.dk...
Does anyone know some c++ code for shutting down windows?
I want to write a program using borland c++ builder to shut down
windows.
--
|
|
|
| Back to top |
|
 |
Dhruv Guest
|
Posted: Sun Jun 29, 2003 6:57 pm Post subject: Re: code for shutting down windows |
|
|
On Sun, 29 Jun 2003 19:04:41 +0100, Jonathan Clements wrote:
| Quote: | We can only hope... (I'm stuck with it though!)
"Patrick Kowalzick" <patrick.kowalzick (AT) web (DOT) de> wrote in message
news:3efdf67c$0$11671$626a54ce (AT) news (DOT) free.fr...
Yes, I've already got it. It's called GNU/Linux. |
And what's better, you don't need Windows to run it!!!
Dhruv.
| Quote: | Is there some code to shut it down forever ?
Patrick
"Jesper" <jesper (AT) i-dont-want-spam (DOT) oek.dk> schrieb im Newsbeitrag
news:bdks63$dcl$1 (AT) news (DOT) net.uni-c.dk...
Does anyone know some c++ code for shutting down windows?
I want to write a program using borland c++ builder to shut down
windows.
--
|
|
|
| Back to top |
|
 |
Jesper Guest
|
Posted: Mon Jun 30, 2003 11:23 am Post subject: Re: [OT] code for shutting down windows |
|
|
Thanks for the helt.
About "Off topic": The c++ language has no concept of planets and gravity
either. Still I can make a program usinc c++ that simulates a system of
planets, just like I can now make a program that shuts down windows. So no,
I don't think it's off topic!!!
--
Mvh. Jesper
"Corey Murtagh" <emonk (AT) slingshot (DOT) co.nz.no.uce> wrote
| Quote: | Jesper wrote:
Does anyone know some c++ code for shutting down windows?
I want to write a program using borland c++ builder to shut down
windows.
The C++ language has no concept of "shutting down windows". Your
question is off topic for this newsgroup. You should ask questions like
this in a newsgroup which deals with Windows.
However, since I do actually know the answer:
ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCEIFHUNG, -1);
Or if you want the system logs on WinXP to show something meaningful:
ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCEIFHUNG, SHTDN_REASON_MAJOR_OTHER |
SHTDN_REASON_MINOR_OTHER | SHTDN_REASON_FLAG_PLANNED);
--
Corey Murtagh
The Electric Monk
"Quidquid latine dictum sit, altum viditur!"
|
|
|
| Back to top |
|
 |
Jason Guest
|
Posted: Wed Jul 02, 2003 3:39 am Post subject: Re: code for shutting down windows |
|
|
int RebootWindows()
{
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
(!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES |
TOKEN_QUERY, &hToken));
LookupPrivilegeValue(NULL, "SeShutdownPrivilege",
&tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
(PTOKEN_PRIVILEGES)NULL, 0);
ExitWindowsEx(EWX_REBOOT, 0);
/*
EWX_FORCE, EWX_REBOOT, EWX_POWEROFF, EWX_LOGOFF, EWX_SHUTDOWN
*/
return 0;
}
|
|
| Back to top |
|
 |
Thomas Matthews Guest
|
Posted: Wed Jul 02, 2003 4:36 pm Post subject: Re: [OT] code for shutting down windows |
|
|
Jesper wrote:
| Quote: | Thanks for the helt.
About "Off topic": The c++ language has no concept of planets and gravity
either. Still I can make a program usinc c++ that simulates a system of
planets, just like I can now make a program that shuts down windows. So no,
I don't think it's off topic!!!
|
The problem is that I tried using the functions that were cited on my
embedded tapedrive system and the compiler complained. Where in the
_standard_ C++ library are these functions?
How can I shutdown the tapedrive by using these functions?
How does it handle the motors?
How can I turn off the laser printer by using these functions?
Hmmm. I guess your topic isn't about _standard_ C++ but about
a platform specific implementation.
I can model a universe on any platform that supports _standard_
C++ as long as I don't use any platform specific code. Discussion
of the functions would be on topic. However, discussion of
functionality that doesn't run on every platform is off-topic.
If I have a home control (embedded) system that has the ability
to open windows to control the indoor temperature and only an
LED display, can it run windows? Is it a Windows platform?
--
Thomas Matthews
C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
|
|
| Back to top |
|
 |
Alexander Terekhov Guest
|
Posted: Wed Jul 02, 2003 5:29 pm Post subject: Re: [OT] code for shutting down windows |
|
|
Thomas Matthews wrote:
[...]
| Quote: | If I have a home control (embedded) system that has the ability
to open windows to control the indoor temperature and only an
LED display, can it run windows? Is it a Windows platform?
|
I see that Matthews is clearly still trying to find a loophole... in
order to "bypass a prison". Oh boy. Give it up, Matthews. Don't waste
time, really. http://google.com/groups?selm=3EFC57C6.8BC34616%40web.de
Yes, it IS a Windows platform. Undoubtedly. What else?!
http://www.microsoft.com/windows/Embedded/ce.NET/evaluation/choose/default.asp
http://www.microsoft.com/windows/Embedded/xp/evaluation/faq/default.asp
<quote>
Q. Why should I use Windows XP Embedded and not Linux?
A. Windows XP Embedded is the componentized version of the leading
desktop operating system, enabling original equipment
manufacturers (OEMs) to rapidly develop the most reliable and
full-featured connected devices. ....
</quote>
regards,
alexander.
|
|
| Back to top |
|
 |
Thomas Matthews Guest
|
|
| Back to top |
|
 |
D. Rush Guest
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|