怎样用VB获取当前系统进程名 要求:

怎样用VB获取当前系统进程名 要求:,第1张

Option Explicit

Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long

Private Declare Function EnumProcesses Lib "PSAPIDLL" (lpidProcess As Long, ByVal cb As Long, cbNeeded As Long) As Long

Private Declare Function GetModuleFileNameEx Lib "PSAPIDLL" Alias "GetModuleFileNameExA" (ByVal hProcess As Long, ByVal hModule As Long, ByVal lpFileName As String, ByVal nSize As Long) As Long

Private Declare Function EnumProcessModules Lib "PSAPIDLL" (ByVal hProcess As Long, lphModule As Long, ByVal cb As Long, lpcbNeeded As Long) As Long

Const PROCESS_QUERY_INFORMATION = &H400

Const PROCESS_VM_READ = &H10

Const MAX_PATH As Long = 260

Private Sub Command1_Click()

Dim szProcessName As String

Dim aProcesses() As Long

Dim hMod(0 To 1023) As Long

Dim hProcess As Long

Dim lLen As Long

Dim cbNeeded As Long

Dim cProcesses As Long

Dim lProcessID As Long

Dim K

Dim i As Long

ReDim aProcesses(0 To 1023) As Long

K = List1ListIndex

List1Clear

If (EnumProcesses(aProcesses(0), 1024 4, cbNeeded) <> 0) Then

cProcesses = cbNeeded / 4

For i = 0 To cProcesses - 1

lProcessID = aProcesses(i)

lLen = MAX_PATH

hProcess = OpenProcess(PROCESS_QUERY_INFORMATION Or PROCESS_VM_READ, 0, lProcessID)

If (lProcessID = 0) Then

List1AddItem "System Idle Process"

ElseIf lProcessID < 5 Then

List1AddItem "System"

Else

If (hProcess <> 0) Then

If (EnumProcessModules(hProcess, hMod(0), 1024 4, cbNeeded)) Then

szProcessName = String$(lLen, 0)

LSet szProcessName = "unknown"

GetModuleFileNameEx hProcess, hMod(0), szProcessName, lLen

List1AddItem szProcessName

End If

End If

End If

Next i

If K < 2 Or K > List1ListCount - 1 Then K = List1ListCount - 1

List1ListIndex = K

Else

MsgBox "Failed to get process list", vbCritical

End If

End Sub

反恐精英online:cstrike-onlineexe

QQ幻想:qqfoexe

地下城与勇士:DNFchinaexe

QQ堂:Clientexe

QQ三国:QQSGexe

QQ炫舞:QQxuexe

英雄岛封测版:Gameexe

QQ飞车:GameAppexe

穿越火线:crossfireexe

梦幻西游:xypqlayerexe

仙剑OL:palonlineexe

数码宝贝OL:digimonexe

以上就是关于怎样用VB获取当前系统进程名 要求:全部的内容,包括:怎样用VB获取当前系统进程名 要求:、求:所有网络游戏 运行时的进程名(即:主程序名) 越全越好、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/9473008.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-28
下一篇 2023-04-28

发表评论

登录后才能评论

评论列表(0条)

保存