Qualcuno sa spiegarmi come fare per ricavare ( in VB ) l'elenco delle applicazioni in eseguzione e terminarle. ?![]()
![]()
Qualcuno sa spiegarmi come fare per ricavare ( in VB ) l'elenco delle applicazioni in eseguzione e terminarle. ?![]()
![]()
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--'
Si, Grazie,![]()
ma come faccio per terminare quello che volgio ???![]()
![]()
prova su http://www.vbsimple.net trovi qualcosa o se no con google