Re: Creating directories and restarting a computer

new topic     » goto parent     » topic index » view thread      » older message » newer message

Here's some (untested) code to shutdown, logoff, or restart in windows:

include dll.e
constant USER32 = open_dll("user32")
constant SHUTDOWNEX = define_c_func(USER32, "ExitWindowsEx", {C_UINT,
C_LONG}, C_INT)
global constant EWX_FORCE = 4, -- Force processes to terminate, don't send
          -- WM_QUERYENDSESSION or WM_ENDSESSION
          -- only use in an emergency
  EWX_LOGOFF = 0,
  EWX_POWEROFF = 8,
  EWX_REBOOT = 2,
  EWX_SHUTDOWN = 1
global procedure win32_shutdown(integer shutdown_type)
    integer x
    x = c_func(SHUTDOWNEX, {shutdown_type, 0})
end procedure

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu