vb如何实现进程监视和管理

rufenguu 2008-02-14 01:18:26
我想通过VB编程获得当前运行的进程的名称和路径,并结束某些进程!请各位大侠指教!!
...全文
237 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
meiZiNick 2008-05-01
  • 打赏
  • 举报
回复
有点难度哦
barenx 2008-03-31
  • 打赏
  • 举报
回复
shulei521 2008-02-21
  • 打赏
  • 举报
回复
软件破解群35780346
从事专业软件逆向 软解破解 精通汇编,精通静态 动态的调试工具,
供大家交流学习。
Cauly123 2008-02-17
  • 打赏
  • 举报
回复
用psapi

Option Explicit
'typedef struct _MODULEINFO { LPVOID lpBaseOfDll; DWORD SizeOfImage;
' LPVOID EntryPoint;} MODULEINFO, *LPMODULEINFO;
Type MODULEINFO
lpBaseOfDLL As Long
SizeOfImage As Long
EntryPoint As Long
End Type
'typedef struct _PROCESS_MEMORY_COUNTERS {
' DWORD cb;
' DWORD PageFaultCount;
' DWORD PeakWorkingSetSize;
' DWORD WorkingSetSize;
' DWORD QuotaPeakPagedPoolUsage;
' DWORD QuotaPagedPoolUsage;
' DWORD QuotaPeakNonPagedPoolUsage;
' DWORD QuotaNonPagedPoolUsage;
' DWORD PagefileUsage;
' DWORD PeakPagefileUsage;
'} PROCESS_MEMORY_COUNTERS;
'typedef PROCESS_MEMORY_COUNTERS *PPROCESS_MEMORY_COUNTERS;
Type PROCESS_MEMORY_COUNTERS
cb As Long
PageFaultCount As Long
PeakWorkingSetSize As Long
WorkingSetSize As Long
QuotaPeakPagedPoolUsage As Long
QuotaPagedPoolUsage As Long
QuotaPeakNonPagedPoolUsage As Long
QuotaNonPagedPoolUsage As Long
PagefileUsage As Long
PeakPagefileUsage As Long
End Type
'typedef struct _PSAPI_WS_WATCH_INFORMATION {
' LPVOID FaultingPc;
' LPVOID FaultingVa;
'} PSAPI_WS_WATCH_INFORMATION, *PPSAPI_WS_WATCH_INFORMATION;
Type PSAPI_WS_WATCH_INFORMATION
FaultingPc As Long
FaultingVa As Long
End Type

'BOOL EmptyWorkingSet( HANDLE hProcess // identifies the process);
Public Declare Function EmptyWorkingSet Lib "PSAPI.DLL" ( _
ByVal hProcess As Long _
) As Long
'BOOL EnumDeviceDrivers(
' LPVOID *lpImageBase, // array to receive the load addresses
' DWORD cb, // size of the array
' LPDWORD lpcbNeeded // receives the number of bytes returned);
Public Declare Function EnumDeviceDrivers Lib "PSAPI.DLL" ( _
lpImageBase() As Long, _
ByVal cb As Long, _
lpcbNeeded As Long _
) As Long
'BOOL EnumProcesses(
' DWORD * lpidProcess, // array to receive the process identifiers
' DWORD cb, // size of the array
' DWORD * cbNeeded // receives the number of bytes returned);
Public Declare Function EnumProcesses Lib "PSAPI.DLL" ( _
lpidProcess As Long, _
ByVal cb As Long, _
cbNeeded As Long _
) As Long
'BOOL EnumProcessModules( HANDLE hProcess, // handle to the process
' HMODULE * lphModule, // array to receive the module handles
' DWORD cb, // size of the array
' LPDWORD lpcbNeeded // receives the number of bytes returned);
Public Declare Function EnumProcessModules Lib "PSAPI.DLL" _
(ByVal hProcess As Long, _
lphModule As Long, _
ByVal cb As Long, _
lpcbNeeded As Long _
) As Long
'DWORD GetDeviceDriverBaseName(
' LPVOID ImageBase, // the load address of the driver
' LPTSTR lpBaseName, // receives the base name of the driver
' DWORD nSize // size of the buffer);
Public Declare Function GetDeviceDriverBaseName Lib "PSAPI.DLL" Alias "GetDeviceDriverBaseNameA" _
(ByVal ImageBase As Long, _
ByVal lpBaseName As String, _
ByVal nSize As Long _
) As Long
'DWORD GetDeviceDriverFileName(
' LPVOID ImageBase, // the load address of the driver
' LPTSTR lpFilename, // buffer that receives the path
' DWORD nSize // size of the buffer);
Public Declare Function GetDeviceDriverFileName Lib "PSAPI.DLL" Alias "GetDeviceDriverFileNameA" _
(ByVal ImageBase As Long, _
ByVal lpFileName As String, _
ByVal nSize As Long _
) As Long
'DWORD GetMappedFileName( HANDLE hProcess, // handle to the process
' LPVOID lpv, // the address to verify
' LPTSTR lpFilename, // buffer that receives the filename
' DWORD nSize // size of the buffer);
Public Declare Function GetMappedFileName Lib "PSAPI.DLL" Alias "GetMappedFileNameA" _
(ByVal hProcess As Long, _
ByVal lpv As Long, _
ByVal lpFileName As String, _
ByVal nSize As Long _
) As Long
'DWORD GetModuleBaseName( HANDLE hProcess, // handle to the process
' HMODULE hModule, // handle to the module
' LPTSTR lpBaseName, // buffer that receives the base name
' DWORD nSize // size of the buffer);
Public Declare Function GetModuleBaseName Lib "PSAPI.DLL" Alias "GetModuleBaseNameA" _
(ByVal hProcess As Long, _
ByVal hModule As Long, _
ByVal lpFileName As String, _
ByVal nSize As Long _
) As Long
'DWORD GetModuleFileNameEx( HANDLE hProcess, // handle to the process
' HMODULE hModule, // handle to the module
' LPTSTR lpFilename, // buffer that receives the path
' DWORD nSize // size of the buffer);
Public Declare Function GetModuleFileNameEx Lib "PSAPI.DLL" Alias "GetModuleFileNameExA" _
(ByVal hProcess As Long, _
ByVal hModule As Long, _
ByVal lpFileName As String, _
ByVal nSize As Long _
) As Long

'BOOL GetModuleInformation( HANDLE hProcess, // handle to the process
' HMODULE hModule, // handle to the module
' LPMODULEINFO lpmodinfo, // structure that receives information
' DWORD cb // size of the structure);
Public Declare Function GetModuleInformation Lib "PSAPI.DLL" _
(ByVal hProcess As Long, _
ByVal hModule As Long, _
lpmodinfo As MODULEINFO, _
ByVal cb As Long _
) As Long
'BOOL GetProcessMemoryInfo( HANDLE Process, // handle to the process
' PPROCESS_MEMORY_COUNTERS ppsmemCounters,
' // structure that receives information
' DWORD cb // size of the structure);
Public Declare Function GetProcessMemoryInfo Lib "PSAPI.DLL" _
(ByVal hProcess As Long, _
ppsmemCounters As PROCESS_MEMORY_COUNTERS, _
ByVal cb As Long _
) As Long
'BOOL GetWsChanges( HANDLE hProcess, // handle to the process
' PPSAPI_WS_WATCH_INFORMATION lpWatchInfo,
' // structure that receives information
' DWORD cb // size of the structure);
Public Declare Function GetWsChanges Lib "PSAPI.DLL" _
(ByVal hProcess As Long, _
lpWatchInfo As PSAPI_WS_WATCH_INFORMATION, _
ByVal cb As Long _
) As Long
'BOOL InitializeProcessForWsWatch( HANDLE hProcess // handle to the process);
Public Declare Function InitializeProcessForWsWatch Lib "PSAPI.DLL" _
(ByVal hProcess As Long _
) As Long
'BOOL QueryWorkingSet( HANDLE hProcess, // handle to the process
' PVOID pv, // buffer that receives the information
' DWORD cb // size of the buffer);
Public Declare Function QueryWorkingSet Lib "PSAPI.DLL" _
(ByVal hProcess As Long, _
pv As Long, _
ByVal cb As Long _
) As Long


chenhui530 2008-02-14
  • 打赏
  • 举报
回复
看这里
http://blog.csdn.net/chenhui530/archive/2007/10/03/1810243.aspx

1,486

社区成员

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

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