shutdown program in c++

This is a discussion on shutdown program in c++ within the C++ Programming forums, part of the General Programming Boards category; How can I make a program which makes my computer shutdown?? I'm using Borland 5.02... I tryed exwindowexit or something ...

  1. #1
    alanair23
    Guest

    shutdown program in c++

    How can I make a program which makes my computer shutdown?? I'm using Borland 5.02... I tryed exwindowexit or something liek that but it didnt work ..... Hope u will help me .. thanx

  2. #2
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    ExitWindowsEx(EWX_POWEROFF,NULL) should shut it down. If you are using windows 9x, it wont work from the console though.

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    17
    So what should I do? I'm using win 98????

  4. #4
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    write it as a windows app and not a console app. Use ExitWindowsEx() as zen has said. Why do you want to do this?
    If all you want is a one-click shutdown icon there is an easier way using Rundll32.exe to run the shutdown function.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  5. #5
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    yet when I tell him this, he yells at me...

  6. #6
    Unregistered
    Guest

    Shutdown,restart

    Speaking of Shutting down and such, how would you call another .exe from your program? Like once you excute it, it would execute something else?
    C:\Windows\rundll.exe,user.exe exitwindowsexec will restart.
    C:\Windows\rundll.exe,user.exe exitwindows will shutdown.
    But im sure most of you already knew that

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  2. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 11:58 PM
  3. I need some help with my program please.
    By agentxx04 in forum C Programming
    Replies: 9
    Last Post: 09-26-2004, 08:51 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 11:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21