网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

vb.netProcess32First和Module32First

Friend Const PROCESS_ALL_ACCESS = &H1F0FFF = 2035711
Friend Const PROCESS_VM_READ = &H10
Friend Const PROCESS_VM_WRITE = &H20
Friend Const PAGE_READONLY = &H2
Friend Const PAGE_READWRITE = &H4
Friend Const TH32CS_SNAPHEAPLIST = &H1 '在快照中包含在th42ProcessID中指定的进程的所有的堆。
Friend Const TH32CS_SNAPPROCESS = &H2 '在快照中包含系统中所有的进程。
Friend Const TH32CS_SNAPTHREAD = &H4 '在快照中包含系统中所有的线程。
Friend Const TH32CS_SNAPMODULE = &H8 '在快照中包含在th42ProcessID中指定的进程的所有的模块。
Friend Const TH32CS_GETALLMODS = &H80000000

Declare Function Process32First Lib "KERNEL32.DLL " (ByVal handle As IntPtr, ByRef pe As PROCESSENTRY32) As Integer
Declare Function Process32Next Lib "KERNEL32.DLL " (ByVal handle As IntPtr, ByRef pe As PROCESSENTRY32) As Integer
Declare Function CreateToolhelp32Snapshot Lib "KERNEL32.DLL " (ByVal flags As Integer, ByVal processid As Integer) As IntPtr
Declare Function CloseHandle Lib "KERNEL32.DLL " (ByVal handle As IntPtr) As Integer
Declare Function Module32First Lib "kernel32" Alias "Module32FirstW" (ByVal hSnapshot As IntPtr, ByRef lppe As MODULEENTRY32) As Boolean
Declare Function Module32Next Lib "kernel32" (ByVal hSnapshot As IntPtr, ByVal lppe As MODULEENTRY32) As Integer

10年积累的成都做网站、成都网站制作经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先做网站后付款的网站建设流程,更有盐池免费网站建设让你可以放心的选择与我们合作。


Public Structure MODULEENTRY32
Public dwSize As Integer
Public th42ModuleID As Integer
Public th42ProcessID As Integer
Public GlblcntUsage As Integer
Public ProccntUsage As Integer
Public modBaseAddr As IntPtr
Public modBaseSize As Integer
Public hModule As IntPtr

Public szModule As String

Public szExePath As String
End Structure

Public Structure ProcessEntry32
Public dwSize As Integer
Public cntUsage As Integer
Public th42ProcessID As Integer
Public th42DefaultHeapID As IntPtr
Public th42ModuleID As Integer
Public cntThreads As Integer
Public th42ParentProcessID As Integer
Public pcPriClassBase As Integer
Public dwFlags As Integer

Public szExeFile As String
End Structure
注:说明符不能丢,丢了就会报命令长度不正确的错误
Private Sub Pro32first()
Dim kzhw As IntPtr
kzhw = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
If kzhw.ToInt32 > 0 Then
Dim mp As ProcessEntry32 = Nothing
mp.dwSize = Marshal.SizeOf(mp)
If (Process32First(kzhw, mp) > 0) Then '遍历第一个进程
Do
ListBox2.Items.Add(mp.szExeFile)
Loop While Process32Next(kzhw, mp) > 0 '遍历所有进程知道返回值为False
End If
End If
End Sub
Private Sub Mod32first()
Dim kzhw As IntPtr
Dim pid As Integer = 3176
kzhw = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pid)

    If kzhw.ToInt32 > 0 Then
        Dim mp As MODULEENTRY32 = Nothing
        mp.dwSize = Marshal.SizeOf(mp)
        ' MsgBox(Module32First(kzhw, mp))
        If Module32First(kzhw, mp) Then
            ListBox1.Items.Add("进程ID:" & mp.th42ProcessID)
            ListBox1.Items.Add("szModule:" & mp.szModule)
            ListBox1.Items.Add("dwSize:" & mp.dwSize)
            ListBox1.Items.Add("modBaseAddr:" & mp.modBaseAddr.ToString)
        End If
    End If
End Sub

本文标题:vb.netProcess32First和Module32First
网页链接:http://bjjierui.cn/article/pgjhse.html

其他资讯