@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: The Toolhelp32ReadProcessMemory API !!!!C# Signature: [DllImport("kernel32.dll")] static extern bool Toolhelp32ReadProcessMemory(uint th32ProcessID, IntPtr lpBaseAddress, [Out] byte [] lpBuffer, UIntPtr cbRead, IntPtr lpNumberOfBytesRead); !!!!VB.NET Signature: <DllImport("kernel32.dll", CharSet:=CharSet.Auto)> _ Public Shared Function Toolhelp32ReadProcessMemory(ByVal th32ProcessID As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal cbRead As Integer, ByRef lpNumberOfBytesRead As Integer) As Integer End Function <DllImport("kernel32.dll", CharSet:=CharSet.Ansi)> _ Public Shared Function Toolhelp32ReadProcessMemory(ByVal th32ProcessID As Integer, ByVal lpBaseAddress As Integer, <Out()> ByVal lpBuffer As Text.StringBuilder, ByVal cbRead As Integer, ByRef lpNumberOfBytesRead As Integer) As Integer End Function !!!!User-Defined Types: None. !!!!Notes: In VB.NET, the 'CharSet' field of the 'DllImport' attribute needed to be set to 'Ansi' instead of 'Auto', and 'lpBuffer' should be defined as 'System.Text.StringBuilder' instead of 'Byte()' when returning a string. !!!!Tips & Tricks: Please add some! !!!!Sample Code: Private Function GetControlProgID(ByVal iProcessID As Integer, ByVal iBaseAddress As Integer, ByVal iBlkSize As Integer) As String Dim iInfoPtr As Integer, iStrPtr As Integer Dim sWork As New Text.StringBuilder(iBlkSize) Try Toolhelp32ReadProcessMemory(iProcessID, iBaseAddress + 44, iInfoPtr, 4, 0) ' Get pointer to class info... Toolhelp32ReadProcessMemory(iProcessID, iInfoPtr + 36, iStrPtr, 4, 0) ' Get pointer to Control Class string... If iStrPtr <> 0 Then Toolhelp32ReadProcessMemory(iProcessID, iStrPtr, sWork, iBlkSize, 0) If (sWork.ToString & " ").Substring(0, 2) <> "VB" Then Return "" Else Return sWork.ToString End If Catch ex As Exception Return "" End Try End Function !!!!Alternative Managed API: Do you know one? Please contribute it! Documentation: Toolhelp32ReadProcessMemory@msdn on MSDN
Edit kernel32.Toolhelp...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.