Board index » delphi » ExitWindowsEx (EWX_SHUTDOWN, 0) in Win95

ExitWindowsEx (EWX_SHUTDOWN, 0) in Win95

I've reviewed many messages in Deja News that indicate
there is a simple way to shutdown and/or reboot a Win95
box using the ExitWindowsEx API call.  From inside a DOS
windows in Win95, this call kills the DOS windows
and the Microsoft Office Shortcut Menu but nothing
else.  Can anyone give me a clue why the C++ or Delphi 2
programs below (which should be equivalent) do not
work?

(Other options, e.g., EWX_REBOOT, etc. don't
seem to work either.  I'm aware that Microsoft
says EWX_LOGOFF doesn't work properly in Win 95, but
the code from the Technet CD that is a workaround
doesn't seem to work either.)

Thanks for any help.

====================================================
C/C++ (Borland C++ 5.0):
  /* To compile:  bcc32 shutdown.c */
  #include <windows.h>
  int main()
  {
    ExitWindowsEx (EWX_SHUTDOWN | EWX_FORCE, 0);
    return 0;
  }

====================================================
Delphi 2:
  {To compile:  dcc32 shutdown.pas}
  {$APPTYPE CONSOLE}
  PROGRAM Shutdown;
    USES  Windows;  
  BEGIN
    ExitWindowsEx (EWX_SHUTDOWN OR EWX_FORCE, 0)
  END.

====================================================
--
Earl F. Glynn          EarlGl...@WorldNet.att.net
EFG Software              913/859-9557  Voice/Fax
   Scientific/Engineering/Medical Applications
             Overland Park, KS  USA

 

Re:ExitWindowsEx (EWX_SHUTDOWN, 0) in Win95


Quote
Earl F. Glynn wrote:
> .. a simple way to shutdown and/or reboot a Win95
> box using the ExitWindowsEx API call...

There's an article you might find helpful at
  http://www.ChamisPlace.com/tips/
Search the Programming section; the article is called
  "Log off, shut down, restart or reboot."

__________________________________________________________________
Grant Walker        Hobart, Tasmania         Ph: +613 62313083
Design Engineer     Australia                Fx: +613 62313086

Other Threads