 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Lethal-byte How do I cheat?
Reputation: 0
Joined: 22 Apr 2008 Posts: 3
|
Posted: Wed Apr 23, 2008 1:34 am Post subject: [Help] Visual basic 2008 |
|
|
Hey, I am kinda new to visual basic and I am looking to make some trainers. I have this code so far but I keep getting an error.
Code: | Public Class Form1
Private Const PROCESS_ALL_ACCESS As Long = &H1F0FFF
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, ByVal lpdwProcessId As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByRef lpBaseAddress As Object, ByRef lpBuffer As Object, ByVal nSize As Single, ByRef lpNumberOfBytesWritten As Integer) As Integer
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal Classname As String, ByVal WindowName As String) As Long
Private Declare Function ReadProcessMem Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Long, ByVal lpNumberOfBytesWritten As Long) As Long
Public ProcessHandle As Long
Public Sub WriteByte(ByVal Address As Long, ByVal Value As Single)
Dim hwnd As Long, pid As Long, phandle As Long
hwnd = FindWindow(vbNullString, "World of Warcraft")
If (hwnd <> 0) Then
GetWindowThreadProcessId(hwnd, pid)
phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
If (phandle <> 0) Then
WriteProcessMemory(phandle, Address, Value, 4, 0)
End If
CloseHandle(phandle)
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Super jump hack
If jump.Checked = True Then
WriteByte("&H8D6080", "3250009464")
End If |
The error is "Arithmetic operation resulted in an overflow." What can I do to fix this?[/code]
|
|
Back to top |
|
 |
Estx Expert Cheater
Reputation: 0
Joined: 04 Mar 2008 Posts: 172
|
Posted: Wed Apr 23, 2008 7:16 am Post subject: |
|
|
If you don't mind using a DLL:
http://forum.cheatengine.org/viewtopic.php?t=213449
It'll make things a lot easier for you.
-- Anyway..
Code: | WriteByte("&H8D6080", "3250009464") |
Remove the quotes.
Code: | Public Sub WriteByte(ByVal Address As Long, ByVal Value As Single) |
Declare Value as Long, not Single - single is a float precision number.
Also, VB.Net has a process class that will simplify getting your WoW Process ID.
Code: | System.Diagnostics.Process.GetProcessesByName("warcraft.exe")[0].Id |
Replace warcraft with whatever the .exe is called (not including ".exe").
Code: | Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByRef lpBaseAddress As Object, ByRef lpBuffer As Object, ByVal nSize As Single, ByRef lpNumberOfBytesWritten As Integer) As Integer |
Change lpBaseAddress to declare as a Long, unless you are going to use IntPtr (can't remember if that's in VB.Net, but if it is - use that). And set nSize to be declared as an Integer.
Buffer is an array of bytes, use BitConverter.GetBytes().
Code: | WriteProcessMemory(phandle, Address, BitConverter.GetBytes(Value), 4, 0) |
Bah, there's a lot of things wrong with your code lol. If you want, you can wait a couple of days - I'll download VB.Net 2008 and write up a class for memory editing so you can opt to learn from that.
Sorry I didn't cover everything, it's just late at night (well early morning). - I'm tired.
|
|
Back to top |
|
 |
Lethal-byte How do I cheat?
Reputation: 0
Joined: 22 Apr 2008 Posts: 3
|
Posted: Thu Apr 24, 2008 2:33 am Post subject: |
|
|
Thanks for the help! Still looking for some more help.
P.S the link for the dll download isn't working for me.
|
|
Back to top |
|
 |
Estx Expert Cheater
Reputation: 0
Joined: 04 Mar 2008 Posts: 172
|
Posted: Thu Apr 24, 2008 5:22 am Post subject: |
|
|
Fixed the link.
|
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|