Jump to content

Recommended Posts

Posted

This is what i made:

#include <GUIConstants.au3>
#include <Process.au3>

$GUI = GUICreate("Kill Program", 233, 251, 192, 125)
;Group
$options_G = GUICtrlCreateGroup("Options", 8, 40, 217, 201)
;RadioButton
$taskkill_R = GUICtrlCreateRadio("Taskkill", 16, 64, 80, 17)
;Input
$programm_I = GUICtrlCreateInput("", 16, 184, 201, 21, -1, $WS_EX_CLIENTEDGE)
;Label
$status_L = GUICtrlCreateLabel("Ready...", 16, 216, 203, 17, $SS_SUNKEN)
$headline_L = GUICtrlCreateLabel("Kill Program", 16, 8, 211, 25)
$program_L = GUICtrlCreateLabel("", 16, 160, 203, 17, $SS_SUNKEN)
;Button
$Go_B = GUICtrlCreateButton("GO", 126, 64, 89, 30)

GUICtrlSetColor($headline_L, "0xff0000")
GUICtrlSetColor($program_L, "0xff0000")
GUICtrlSetFont($headline_L, 14, 400, "", "Arial")
GUICtrlSetState($programm_I, $GUI_FOCUS)
GUISetState(@SW_SHOW)


GUICtrlSetState($taskkill_R, $GUI_CHECKED)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Go_B
            If GUICtrlRead($taskkill_R) = $GUI_CHECKED Then _taskkill() 
        Case Else
       ;;;;;;;
    EndSelect
WEnd

Func _taskkill()
    $rc = _RunDOS("start taskkill /F /IM Nstdw32.exe /T")
    GUICtrlSetData($status_L, "Process closed")
    Sleep(2500)
    GUICtrlSetData($status_L, "Ready...")
EndFunc ;==>_taskkill

i hope it will work

I little problem, hard to find and fix

  • Replies 42
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

Hi,

I tried to optimze it for you. Hope you like it.

#include <GUIConstants.au3>
#include <Process.au3>

$GUI = GUICreate("Kill Program", 233, 251, 192, 125)
;Group
$options_G = GUICtrlCreateGroup("Options", 8, 40, 217, 201)
;RadioButton
$input_R = GUICtrlCreateRadio("Input", 16, 64, 80, 17)
$choose_R = GUICtrlCreateRadio("Choose", 16, 94, 80, 17)
;Input
$programm_I = GUICtrlCreateInput("Nstdw32.exe", 16, 184, 201, 21, -1, $WS_EX_CLIENTEDGE)
;Label
$status_L = GUICtrlCreateLabel("Ready...", 16, 216, 203, 17, $SS_SUNKEN)
$headline_L = GUICtrlCreateLabel("Kill Program", 16, 8, 211, 25)
$program_L = GUICtrlCreateLabel("", 16, 160, 203, 17, $SS_SUNKEN)
;Button
$Go_B = GUICtrlCreateButton("GO", 126, 64, 89, 30, $BS_DEFPUSHBUTTON)
;ComboBox
$processCombo_C = GUICtrlCreateCombo("", 16, 184, 201, 21)
GUICtrlSetState($processCombo_C, $GUI_HIDE)

GUICtrlSetColor($headline_L, "0xff0000")
GUICtrlSetColor($program_L, "0xff0000")
GUICtrlSetFont($headline_L, 14, 400, "", "Arial")
GUICtrlSetState($programm_I, $GUI_FOCUS)
GUISetState(@SW_SHOW)

GUICtrlSetState($input_R, $GUI_CHECKED)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Go_B
            _taskkill()
        Case $msg = $choose_R
            GUICtrlSetState($programm_I, $GUI_HIDE)
            GUICtrlSetState($processCombo_C, $GUI_SHOW)
            _processCombo()
        Case $msg = $input_R
            GUICtrlSetState($programm_I, $GUI_SHOW)
            GUICtrlSetState($processCombo_C, $GUI_HIDE)
        Case Else
        ;;;;;;;
    EndSelect
WEnd

Func _taskkill()
    $rc = _RunDOS("start taskkill /F /IM " & GUICtrlRead($programm_I) & " /T")
    GUICtrlSetData($status_L, "Process closed")
    Sleep(2500)
    GUICtrlSetData($status_L, "Ready...")
EndFunc  ;==>_taskkill

Func _processCombo()
    Dim $processArray = ProcessList()
    For $i = 1 To $processArray[0][0]
        GUICtrlSetData($processCombo_C, $processArray[$i][0])
    Next
EndFunc  ;==>_processCombo

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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
  • Recently Browsing   0 members

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