Jump to content

Process close, with delay and cancel.


jvanegmond
 Share

Recommended Posts

Select a process, type how many seconds you want it to wait and click close to close the process.

or type how many seconds you want to delay shutdown, and press cancel to abort shutdown.

Global Const $GUI_EVENT_CLOSE = -3

Dim $msg

GUICreate ( "Timer v. 0.1 !", 300, 310)
$mylist=GUICtrlCreateList ("", 10, 10, 200, 250)
$sleep = GUICtrlCreateInput ( "0", 10,  265, 200, 20)
$close=GUICtrlCreateButton("Close", 220, 10, 70)
$shutdown=GUICtrlCreateButton("Shutdown", 220, 40, 70)
$cancel=GUICtrlCreateButton("Cancel", 220, 70, 70)
GUICtrlCreateLabel ("Select a process, press Close to end it. Press cancel to stop shutdown. Type # of seconds left-down to delay.",  220, 100, 70, 200)
$time=GUICtrlCreateLabel("", 220, 300)
Get()
GUISetState ()

While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
    Select
        Case $msg = $close
            Sleep(GUICtrlRead($sleep) * 1000)
            ProcessClose( GUICtrlRead($mylist) )
            Get()
        Case $msg = $shutdown
            Run("Shutdown -s -t " & GUICtrlRead($sleep))
        Case $msg = $cancel
            Run("Shutdown -a")
    EndSelect
Wend
Exit

Func Get()
    $list = ProcessList() 
    for $i = 2 to $list[0][0]
        GUICtrlSetData($mylist,$list[$i][0])
    next
EndFunc

:o

Edited by Manadar
Link to comment
Share on other sites

Useful unless like me you select shutdown instead of close. :">


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...