如何取得当前系统中运行的程序??

MrCao 2004-04-17 02:00:08
我现在需要取得当前系统中正在运行的程序 ,就象windows任务管理器的应用程序块那样,请问该如何做????
...全文
41 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
CruelYoung123 2004-05-12
  • 打赏
  • 举报
回复
在调试,看行不
fuanwei 2004-04-19
  • 打赏
  • 举报
回复
Declare Function ProcessNext Lib "kernel32" Alias "Process32Next" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Declare Function CreateToolhelpSnapshot Lib "kernel32" Alias "CreateToolhelp32Snapshot" (ByVal lFlags As Long, lProcessID As Long) As Long
Declare Function ProcessFirst Lib "kernel32" Alias "Process32First" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Const TH32CS_SNAPPROCESS As Long = 2&


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 * 260
End Type
MrCao 2004-04-17
  • 打赏
  • 举报
回复
ProcessNext ProcessFirst 函数在那里定义??
MrCao 2004-04-17
  • 打赏
  • 举报
回复
还有CreateToolhelpSnapshot方法在那里定义?
MrCao 2004-04-17
  • 打赏
  • 举报
回复
请问一下PROCESSENTRY32结构怎么定义
fuanwei 2004-04-17
  • 打赏
  • 举报
回复
Private Const WM_SYSCOMMAND = &H112
Private Const SC_MOVE = &HF010&
Private Const SC_RESTORE = &HF120&
Private Const SC_SIZE = &HF000&
Private Declare Function RegCreateKey& Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey&, ByVal lpszSubKey$, lphKey&)
Private Declare Function RegSetValue Lib "advapi32.dll" Alias "RegSetValueA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long
Const HKEY_LOCAL_MACHINE = &H80000002
Const REG_SZ = 1

Private Sub RefreshProcessList()
Dim myProcess As PROCESSENTRY32
Dim mySnapshot As Long
cboProcess.Clear
myProcess.dwSize = Len(myProcess)
mySnapshot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)
ProcessFirst mySnapshot, myProcess
cboProcess.AddItem myProcess.szexeFile
While ProcessNext(mySnapshot, myProcess)
cboProcess.AddItem myProcess.szexeFile ' set exe name
PIDs(cboProcess.ListCount - 1) = myProcess.th32ProcessID ' ' store PID
Wend
End Sub
调用 RefreshProcessList

1,066

社区成员

发帖
与我相关
我的任务
社区描述
VB 资源
社区管理员
  • 资源
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧