1. Shutdown Win2000/XP
- Posted by C Bouzy <eucoder at hotmail.com> Mar 05, 2006
- 511 views
- Last edited Mar 06, 2006
Hello All, Does anyone know how I can completely shutdown Win2000/XP using EU code? ----C Bouzy ----If you continue to do what you have always done, you will get what you have always gotten.----
2. Re: Shutdown Win2000/XP
- Posted by Vincent <darkvincentdude at yahoo.com> Mar 05, 2006
- 473 views
- Last edited Mar 06, 2006
C Bouzy wrote: > > Hello All, > > Does anyone know how I can completely shutdown Win2000/XP using EU code? > > ----C Bouzy > > ----If you continue to do what you have always done, > you will get what you have always gotten.----
system("shutdown -f -s -t 0", 0)
Regards, Vincent
3. Re: Shutdown Win2000/XP
- Posted by Al Getz <Xaxo at aol.com> Mar 05, 2006
- 457 views
- Last edited Mar 06, 2006
C Bouzy wrote: > > Hello All, > > Does anyone know how I can completely shutdown Win2000/XP using EU code? > > ----C Bouzy > > ----If you continue to do what you have always done, > you will get what you have always gotten.---- Hi there, You could try this using system(): C:\WINDOWS\SYSTEM32\shutdown.exe It works under XP. Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"
4. Re: Shutdown Win2000/XP
- Posted by C Bouzy <eucoder at hotmail.com> Mar 05, 2006
- 472 views
- Last edited Mar 06, 2006
Hello Vincent/Al Thanks for the code. It works but I am trying to avoid the DOS popup box. I have been trying the following code, but it does not shutdown the computer fully. constant USER32 = open_dll("user32") constant SHUTDOWNEX = define_c_func(USER32, "ExitWindowsEx", {C_UINT, C_LONG}, C_INT) global constant EWX_FORCE = 4, 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 win32_shutdown(or_all({EWX_FORCE,EWX_FORCE})) ----If you continue to do what you have always done, you will get what you have always gotten.----
5. Re: Shutdown Win2000/XP
- Posted by Bernie Ryan <xotron at bluefrog.com> Mar 05, 2006
- 468 views
- Last edited Mar 06, 2006
C Bouzy wrote: > > Hello All, > > Does anyone know how I can completely shutdown Win2000/XP using EU code? > Maybe this might help: http://www.codeproject.com/system/StayON.asp Bernie My files in archive: WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API Can be downloaded here: http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan
6. Re: Shutdown Win2000/XP
- Posted by Chris Burch <chriscrylex at aol.com> Mar 05, 2006
- 470 views
- Last edited Mar 06, 2006
Hi I use this if I I'm doing something thats going to take a long time, ANd I need the computer shut down later.
-- code generated by Win32Lib IDE v0.18.23r include Win32Lib.ew without warning -------------------------------------------------------------------------------- -- Window Window1 sequence IDEFlags IDEFlags = classDefaults(Window, { {1, {WS_SYSMENU}},{2, {WS_EX_DLGMODALFRAME}} } ) constant Window1 = createEx( Window, "", 0, Default, Default, 126, 136, {WS_DLGFRAME, WS_SYSMENU}, {WS_EX_DLGMODALFRAME} ) constant LText2 = createEx( LText, "Minutes to shudown", Window1, 8, 8, 112, 20, 0, 0 ) constant EditText3 = createEx( EditText, "", Window1, 16, 32, 84, 20, 0, 0 ) constant PushButton4 = createEx( PushButton, "Go", Window1, 16, 60, 84, 28, 0, 0 ) --------------------------------------------------------- sequence IDE_labeltable IDE_labeltable = { {Window1,"Layer 0",EditText3}, {Window1,"Layer 0",LText2}, {Window1,"Layer 0",PushButton4}, {Window1,"Layer 0",Window1} } function setLayerVisible(integer windowName,sequence layerName,integer state) integer foundIt foundIt=0 for i=1 to length(IDE_labeltable) do if equal(windowName,IDE_labeltable[i][1]) and equal(layerName,IDE_labeltable[i][2]) then setVisible(IDE_labeltable[i][3],state) foundIt=w32True elsif foundIt then exit end if end for if foundIt then return 0 else return 1 end if end function function setLayerEnable(integer windowName,sequence layerName,integer state) integer foundIt foundIt=0 for i=1 to length(IDE_labeltable) do if equal(windowName,IDE_labeltable[i][1]) and equal(layerName,IDE_labeltable[i][2]) then setEnable(IDE_labeltable[i][3],state) foundIt=w32True elsif foundIt then exit end if end for if foundIt then return 0 else return 1 end if end function -------------------------------------------------------------------------------- procedure PushButton4_onClick (integer self, integer event, sequence params)--params is () integer mins sequence cmd_str integer MsgBox mins = w32TextToNumber(getText(EditText3)) if mins > 0 then cmd_str = sprintf("shutdown -f -s -t %d", {60*mins}) --integer MsgBox --MsgBox = message_box(cmd_str, "Title", #0) system(cmd_str, 0) else abort(0) end if end procedure setHandler( PushButton4, w32HClick, routine_id("PushButton4_onClick")) WinMain( Window1,Normal )
http://members.aol.com/chriscrylex/euphoria.htm http://uboard.proboards32.com/ http://members.aol.com/chriscrylex/EUSQLite/eusql.html
7. Re: Shutdown Win2000/XP
- Posted by "Wolf" <wolfritz at king.igs.net> Mar 06, 2006
- 486 views
> Does anyone know how I can completely shutdown Win2000/XP using EU code? --shut down Windows, also, if ATX, power. --only tested on 98, 2K include dll.e include machine.e include misc.e constant KERNEL32=open_dll("kernel32.dll") ,GetVersion=define_c_func(KERNEL32,"GetVersion",{},C_UINT) ,GetCurrentProcess=define_c_func(KERNEL32,"GetCurrentProcess",{},C_UINT) ,hToken=allocate(4) ,ADVAPI32=open_dll("advapi32.dll") ,OpenProcessToken=define_c_func(ADVAPI32,"OpenProcessToken", {C_UINT,C_UINT,C_POINTER},C_UINT) ,TOKEN_ADJUST_PRIVILEGES=#20 ,TOKEN_QUERY=#8 ,struct_TOKEN_PRIVILEGES=allocate(16) --4 for count + 12 per privilege ,LookupPrivilegeValue=define_c_func(ADVAPI32,"LookupPrivilegeValueA", {C_POINTER,C_POINTER,C_POINTER},C_UINT) ,SE_SHUTDOWN_NAME=allocate_string("SeShutdownPrivilege") ,SE_PRIVILEGE_ENABLED=2 ,AdjustTokenPrivileges=define_c_func(ADVAPI32,"AdjustTokenPrivileges", {C_UINT,C_UINT,C_POINTER,C_UINT,C_POINTER,C_POINTER},C_UINT) --Win9x's really only need items below ,USER32=open_dll("user32.dll") ,ExitWindowsEx=define_c_func(USER32,"ExitWindowsEx",{C_UINT,C_UINT},C_UINT) ,EWX_SHUTDOWN=1 --,EWX_FORCE=4 --not used here function hi_word( atom d ) return floor(d/#10000) end function atom current, jk --is this NT/2000/XP? if hi_word( c_func(GetVersion,{}) ) < #8000 then mem_set(struct_TOKEN_PRIVILEGES,0,16) current=c_func(GetCurrentProcess,{}) jk=c_func(OpenProcessToken, {current,TOKEN_ADJUST_PRIVILEGES+TOKEN_QUERY,hToken}) if jk then poke4(struct_TOKEN_PRIVILEGES,1) --only one privilege --to enable privilege poke4(struct_TOKEN_PRIVILEGES+12,SE_PRIVILEGE_ENABLED) --get Luid into same struct jk=c_func(LookupPrivilegeValue,{0,SE_SHUTDOWN_NAME,struct_TOKEN_PRIVILEGES+4}) jk=c_func(AdjustTokenPrivileges,{peek4u(hToken),0,struct_TOKEN_PRIVILEGES,0,0,0}) printf(1,"%s\n",{"..attempting NT/2000/XP shutdown"}) sleep(2) free_console() --apparently not necessary on NT/XP jk=c_func(ExitWindowsEx,{EWX_SHUTDOWN,0}) end if else printf(1,"%s\n",{"..attempting Win9x/ME shutdown"}) sleep(2) free_console() -- you *must* do this for 9x's, if using console. jk=c_func(ExitWindowsEx,{EWX_SHUTDOWN,0}) end if
8. Re: Shutdown Win2000/XP
- Posted by C Bouzy <eucoder at hotmail.com> Mar 06, 2006
- 499 views
- Last edited Mar 07, 2006
Wolf wrote: > > --shut down Windows, also, if ATX, power. > --only tested on 98, 2K Thank you Wolf... This is what I needed, I did not know about TOKEN_PRIVILEGES..etc..etc, which was the reason why it would not shut down fully. ----If you continue to do what you have always done, you will get what you have always gotten.----