Visualizzazione dei risultati da 1 a 5 su 5
  1. #1
    Utente di HTML.it L'avatar di goku370
    Registrato dal
    Oct 2003
    Messaggi
    569

    VB Visualizzare e terminare task

    Qualcuno sa spiegarmi come fare per ricavare ( in VB ) l'elenco delle applicazioni in eseguzione e terminarle. ?


  2. #2
    Utente di HTML.it L'avatar di goku370
    Registrato dal
    Oct 2003
    Messaggi
    569
    UP

  3. #3
    Utente di HTML.it
    Registrato dal
    Nov 2002
    Messaggi
    2,460
    BAS Module Code

    Place the following code into the general declarations area of a bas module:

    --------------------------------------------------------------------------------

    Option Explicit
    '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''
    ' Copyright ©1996-2003 VBnet, Randy Birch, All Rights Reserved.
    ' Some pages may also contain other copyrights by the author.
    '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''
    ' Distribution: You can freely use this code in your own
    ' applications, but you may not reproduce
    ' or publish this code on any web site,
    ' online service, or distribute as source
    ' on any media without express permission.
    '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''
    Public Const TH32CS_SNAPPROCESS As Long = 2&
    Public Const MAX_PATH As Long = 260

    Public Type PROCESSENTRY32
    dwSize As Long
    cntUsage As Long
    th32ProcessID As Long
    th32DefaultHeapID As Long
    th32ModuleID As Long
    cntThreads As Long
    th32ParentProcessID As Long
    pcPriClassBase As Long
    dwFlags As Long
    szExeFile As String * MAX_PATH
    End Type


    Public Declare Function CreateToolhelp32Snapshot Lib "kernel32" _
    (ByVal lFlags As Long, ByVal lProcessID As Long) As Long

    Public Declare Function ProcessFirst Lib "kernel32" _
    Alias "Process32First" _
    (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long

    Public Declare Function ProcessNext Lib "kernel32" _
    Alias "Process32Next" _
    (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long

    Public Declare Sub CloseHandle Lib "kernel32" _
    (ByVal hPass As Long)
    '--end block--'


    Form Code

    To a form containing a list box (List1) and a command button (Command1), add the following code:

    --------------------------------------------------------------------------------

    Option Explicit
    Private Sub Command1_Click()

    Dim hSnapShot As Long
    Dim uProcess As PROCESSENTRY32
    Dim success As Long

    hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0&)

    If hSnapShot = -1 Then Exit Sub

    uProcess.dwSize = Len(uProcess)
    success = ProcessFirst(hSnapShot, uProcess)

    If success = 1 then

    Do
    List1.AddItem uProcess.szExeFile
    Loop While ProcessNext(hSnapShot, uProcess)

    End If

    Call CloseHandle(hSnapShot)

    End Sub
    '--end block--'

  4. #4
    Utente di HTML.it L'avatar di goku370
    Registrato dal
    Oct 2003
    Messaggi
    569
    Si, Grazie,

    ma come faccio per terminare quello che volgio ???

  5. #5
    Utente di HTML.it
    Registrato dal
    Nov 2002
    Messaggi
    2,460
    prova su http://www.vbsimple.net trovi qualcosa o se no con google

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.