Yannick
Nombre de messages : 8635 Age : 53 Localisation : Bretagne Date d'inscription : 15/02/2010
| Sujet: Task Killer Dim 2 Aoû 2015 - 21:45 | |
| Une version revisité de celle de JL35. Le zip sera sur mon webdav dans quelques minutes. - Code:
-
hide 0 Variables() Labels() Init() Gui() show 0 end ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ' DECLARATION DES VARIABLES ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ SUB Variables() ' dossiers dim temp$ ' fichiers dim kgf$ dim ico1$ dim ico2$ ' objets dim no% dim dltsk% :no% = no%+1 : dltsk% = no% dim frame% :no% = no%+1 : frame% = no% dim hookedit% :no% = no%+1 : hookedit% = no% dim hookbut1% :no% = no%+1 : hookbut1% = no% dim hookbut2% :no% = no%+1 : hookbut2% = no% dim pict% :no% = no%+1 : pict% = no% dim Proclist% :no% = no%+1 : Proclist% = no% ' événement dim Nclic% dim Nchange% ' appli dim Task$ END_SUB ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ' DECLARATION DES LABELS ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ SUB Labels() Label Clic Label Change END_SUB ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ' INITIALISATIONS ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ SUB Init() temp$ = "C:\Temp\" kgf$ = "KGF.dll" dll_on kgf$ ico1$ = "Stop.jpg" ico2$ = "Stop2.jpg" dlist dltsk% DetectTask() END_SUB ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ' INTERFACE UTILISATEUR ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ SUB Gui() dim_local res%,h%,w%,x%
height 0,450 width 0,300 top 0,(screen_y-height(0))/2 left 0,(screen_x-width(0))/2
Panel frame% full_space frame% h%=height(frame%) w%=width(frame%) hide frame% edit hookedit% :hide hookedit% button hookbut1% :hide hookbut1% : on_click hookbut1%,clic button hookbut2% :hide hookbut2% : on_click hookbut2%,clic
picture pict% height pict%,32 width pict%,32 top pict%,2 left pict%,5 file_load pict%,ico1$ stretch_on pict% cursor_point pict% on_click pict%,clic
list proclist% height proclist%,h%-42 width proclist%,w%-10 top proclist%,37 left proclist%,5 font_name proclist%,"Arial" font_size proclist%,8 cursor_point proclist% on_click proclist%,clic inactive proclist%
res% = dll_call2("ClickSetHook",handle(0),handle(hookedit%)) res% = dll_call5("ClickDefineRect",1,5,2,32,32) res% = dll_call3("ClickSetLinkRect",handle(hookbut1%),5,1) res% = dll_call3("ClickSetLinkRect",handle(hookbut2%),6,1) if count(dltsk%)>1 RempProclist() end_if
END_SUB ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ' MENU ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Clic: Nclic% = number_click if Nclic% = Pict% : KillTask(Task$) : return : end_if if Nclic% = Proclist% : Selection() : return : end_if if Nclic% = hookbut1% : file_load pict%,ico2$ : return : end_if if Nclic% = hookbut2% : file_load pict%,ico1$ : return : end_if return ' ------------------------------------------------------------------------------ Change: Nchange% = number_change if Nchange% = hookedit% :ChangeIco() : return : end_if return ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ' FONCTIONS ET PROCEDURES ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ SUB DetectTask() dim_local fm$,a$,nta,i% fm$ = "C:\Temp\Tasklist.txt": ' fichier de manoeuvre, -- A AJUSTER -- ' paramètres de Tasklist, voir: http://windows.developpez.com/cours/ligne-commande/?page=page_19
Exprog("Cmd.exe /c Tasklist.exe >" + fm$) FILE_OPEN_READ 1, fm$ FILE_LOAD dltsk%,fm$ FILE_DELETE fm$ END_SUB ' ------------------------------------------------------------------------------ SUB Exprog(prog$) ' Exécution d'un programme externe sans la fenêtre noire ms-dos DIM_LOCAL scr$, bat$, axp$ scr$ = Temp$+"Vbscript.vbs" bat$ = Temp$+"Bat.bat" ' ===== Création du fichier .bat FILE_OPEN_WRITE 9, bat$: FILE_WRITELN 9, prog$: FILE_CLOSE 9 ' ===== Création du script .vbs axp$ = "CreateObject("+CHR$(34)+"Wscript.Shell"+CHR$(34)+").Run " axp$ = axp$ + CHR$(34) + bat$ + CHR$(34) + ", 0, True" FILE_OPEN_WRITE 9, scr$: FILE_WRITELN 9, axp$: FILE_CLOSE 9 ' ===== Exécution du script EXECUTE_WAIT "WSCRIPT.exe "+scr$ FILE_DELETE bat$: FILE_DELETE scr$ END_SUB ' ------------------------------------------------------------------------------ SUB RempProclist() dim_local i%,a$ for i%=1 to count(dltsk%) a$=item_read$(dltsk%,i%) if instr(a$,"Console")>0 a$ = LEFT$(a$,20) item_add Proclist%,a$ end_if next i% sort_on proclist% if count(proclist%)>0 : active proclist% : end_if END_SUB ' ------------------------------------------------------------------------------ SUB Selection() if count(proclist%)>0 Task$=item_index$(proclist%) end_if END_SUB ' ------------------------------------------------------------------------------ SUB KillTask(T$) if T$<>"" Exprog("Cmd.exe /c taskkill.exe /F /IM " + T$) message "La tache - "+t$+" - est tué !!!" else message "Veuillez sélectionner une tache à tuer..." end_if END_SUB | |
|