⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 showallrunningprograms.txt

📁 一部分关于VB编程的小技巧
💻 TXT
字号:
Option Explicit

Private Const TH32CS_SNAPPROCESS As Long = 2&
Private Const MAX_PATH As Integer = 260

Private 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

Private Declare Function CreateToolhelpSnapshot _
Lib "Kernel32" Alias "CreateToolhelp32Snapshot" _
(ByVal lFlags As Long, ByVal lProcessID As Long) As Long

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

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

Private Declare Sub CloseHandle Lib "Kernel32" _
(ByVal hPass As Long)


Private Sub Command1_Click()

    Dim hSnapShot As Long
    Dim uProcess As PROCESSENTRY32
    Dim r As Long

    hSnapShot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)

    If hSnapShot = 0 Then
        Exit Sub
    End If

    uProcess.dwSize = Len(uProcess)

    r = ProcessFirst(hSnapShot, uProcess)

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

    Call CloseHandle(hSnapShot)

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -