WriteText Code:
Public Sub WriteText(ByVal lngAddress As Integer, ByVal strText As String) Dim hWnd As Object, processHandle As Object, processId As Integer Dim fixedStr As String = "" hWnd = FindWindow(vbNullString, CurrentProcess) If (hWnd = 0) Then Exit Sub GetWindowThreadProcessId(hWnd, processId) processHandle = OpenProcess(PROCESS_ALL_ACCESS, False, processId) fixedStr = strText & Chr(0) WriteProcessMemory(processHandle, lngAddress, fixedStr, Len(fixedStr), 0) CloseHandle(processHandle) End Sub
Functions :
Private Const PROCESS_ALL_ACCESS As Long = &H1F0FFF Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Integer, ByRef lpdwProcessId As Integer) As Integer Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddressAsAny As Integer, ByRef lpBufferAsAny As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddressAsAny As Integer, ByRef lpBufferAsAny As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Integer) As Integer Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByRef lParamAsAny As Integer) As Integer Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer Private Declare Sub ReleaseCapture Lib "user32" Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Integer, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer Private Declare Function VirtualAllocEx Lib "kernel32" (ByVal hProcess As Integer, ByVal lpAddress As Integer, ByVal dwSize As Integer, ByVal flAllocationType As Integer, ByVal flProtect As Integer) As Integer Private Declare Function VirtualFreeEx Lib "kernel32" (ByVal hProcess As Integer, ByRef lpAddressAsAny As Integer, ByVal dwSize As Integer, ByVal dwFreeType As Integer) As Integer Private Declare Function CreateRemoteThread Lib "kernel32" (ByVal hProcess As Integer, ByRef lpThreadAttributes As Integer, ByVal dwStackSize As Integer, ByRef lpStartAddress As Integer, ByRef lpParameterAsAny As Integer, ByVal dwCreationFlags As Integer, ByRef lpThreadId As Integer) As Integer Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer) Private Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal lFlags As Integer, ByVal lProcessID As Integer) As Integer Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal Classname As String, ByVal WindowName As String) As Integer Public Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Integer, ByVal lpProcName As String) As Integer Public Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Integer Public Declare Function GetKeyPress Lib "user32" Alias "GetAsyncKeyState" (ByVal Key As Integer) As Short Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Integer) Public Declare Function SetParent Lib "user32" (ByVal hWndChild As Integer, ByVal hWndNewParent As Integer) As Integer Dim CurrentProcess As String="Window Name"
Rate What's wrong?

New Topic/Question
Reply




MultiQuote







|