WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Reboot and Shutdown Topics

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Get to "It's Now Safe to Turn Off Your Computer" Message

Keywords:     intcontrol 68

Question:

Winbatch won't really shut down win95 (or win95 doesn't play very well) without a reboot....so how do you sendkey to the start menu?? (You know, that flying window key on a w95 keyboard?)

I'm looking for the "It's now safe to turn off your computer" screen, but I can't get there from here.

Answer:

Here is some sample code from one of our users.

There are two pieces to it: the Dialog code, and the main WBT, as follows:

CLOSE95.WDL


CloseFormat=`WWWDLGED,5.0`

CloseCaption=`Close Win95`
CloseX=156
CloseY=151
CloseWidth=156
CloseHeight=97
CloseNumControls=6

Close01=`4,50,64,DEFAULT,RADIOBUTTON,ExitVal,"Exit this routine",2`
Close02=`80,50,64,DEFAULT,RADIOBUTTON,ExitVal,"Logon New User",3`
Close03=`80,18,64,DEFAULT,RADIOBUTTON,ExitVal,"Restart Computer",4`
Close04=`80,2,64,DEFAULT,RADIOBUTTON,ExitVal,"Shutdown Computer",5`
Close05=`46,78,64,DEFAULT,PUSHBUTTON,DEFAULT,"OK",1`
Close06=`80,34,72,DEFAULT,RADIOBUTTON,ExitVal,"Restart in MS-DOS Mode",6`

ButtonPushed=Dialog("Close")


CLOSE95.WBT

;*** All disclaimers and legal mumbojumbo that are always applied to shareware/freeware
;*** apply to this chunk of code too.  Every effort was made to throughly debug this script
;*** before sending it out. However, I make ABSOLUTELY NO WARRANTEE, EXPRESS OR IMPLIED,
;*** as to the operation of this script.
;***
;*** This routine was chopped out of a larger piece of code that I wrote, which is why it
;*** calls a dialog for user input.  The routine uses SendKey commands instead of IntControl
;*** commands to shut down Win95. If you don't want to offer options for shutdown, you can
;*** just select the lines applicable to the type of shutdown that you wish to perform.
;*** Note that during this routine, all of the screens normally seen during a shutdown will
;*** be shown but the "keystrokes" are automatically passed.


;************  Call dialog and if requested, exit windows

Call ("Close95.WDL","")                                 ;Call shutdown dialog

Switch Close

        Case 2                                          ;Exit this routine
                goto Bailout

        Case 3                                          ;logon new user
                Gosub Close_all
                SendKey ("^{ESC}")
                SendKey ("u")
                SendKey ("c")
                SendKey ("y")
                Exit

        Case 4                                          ;Restart computer
                Gosub Close_all
                SendKey ("^{ESC}")
                SendKey ("u")
                SendKey ("r")
                SendKey ("y")
                Exit

        Case 5                                          ;Shut down computer
                Gosub Close_all
                SendKey ("^{ESC}")
                SendKey ("u")
                SendKey ("s")
                SendKey ("y")
                Exit

        Case 6                                          ;Restart in MS-DOS Mode
                Gosub Close_all
                SendKey ("^{ESC}")
                SendKey ("u")
                SendKey ("M")
                SendKey ("y")
                Exit

EndSwitch
:Bailout
exit

:Close_all                                                              ;Close all windows except hidden
windows = WinItemize()
cnt=ItemCount(windows, @tab)
for c = 1 to cnt
current = ItemExtract(c, windows, @TAB)
if StrIndexNc(current, "Close95.wbt", 1, @FWDSCAN) != 0 then continue	 ;skip if window is for this script
if WinState(current) == @HIDDEN then continue			    ;skip if window is hidden
WinClose(current)
next
IntControl(12,5,0,0,0)							;Allow quiet termination of script
return


Article ID:   W13314
Filename:   Its Now Safe to Turn Off Your Computer Message.txt
File Created: 1999:04:15:16:53:12
Last Updated: 1999:04:15:16:53:12