@VB Programmers (Conquer)

04/19/2006 05:06 Chanceler#1
I'm used to programming for a game called Tibia and in it I use a couple simple scripts, one of these scripts is this:

Code:
Public Function Tibia_Hwnd()
 Dim tibiaclient As Long
 tibiaclient = FindWindow("tibiaclient", vbNullString)
 
 'Return hwnd to function
 Tibia_Hwnd = tibiaclient
End Function
Anyways, how would I adjust this to Conquer?

Also, reading is like this:

Code:
Public Function Memory_ReadLong(windowHwnd As Long, Address As Long) As Long
 
  ' Declare some variables we need
  Dim pid As Long     ' Used to hold the Process Id
  Dim phandle As Long   ' Holds the Process Handle
  Dim valbuffer As Long  ' Long
  
  ' First get a handle to the "game" window
  If (windowHwnd = 0) Then Exit Function
  
  ' We can now get the pid
  GetWindowThreadProcessId windowHwnd, pid
  
  ' Use the pid to get a Process Handle
  phandle = OpenProcess(PROCESS_VM_READ, False, pid)
  If (phandle = 0) Then Exit Function
  
  ' Read Long
  ReadProcessMemory phandle, Address, valbuffer, 4, 0&
    
  ' Return
  Memory_ReadLong = valbuffer
  
  ' Close the Process Handle
  CloseHandle phandle
 
End Function
Same question, yes I'm very new here, but it's just these that I'm suffereing with here.
(If this is the wrong thread feel free to move it~)

~Chanceler~
04/19/2006 05:47 ChrisR872#2
How about instead of "tibiaclient", try "[Conquer2.0]"

Shouldn't be doing such challenging code if you can't understand what it's doing.

~Chris
04/19/2006 06:28 Doobs#3
Quote:
Originally posted by ChrisR872@Apr 19 2006, 05:47
How about instead of "tibiaclient", try "[Conquer2.0]"

Shouldn't be doing such challenging code if you can't understand what it's doing.

~Chris
lol yeah hes right....

Edit: Hes right in both points he makes...
04/19/2006 14:57 unknownone#4
No. where you have tibiaclint stick a vbnullstring, then put Conquer in the second arg.

FindWindow(vbnullstring, "[Conquer2.0]")

Arg1 takes a classname, second arg takes the window name.
04/19/2006 15:57 ChrisR872#5
Yep, unknownone is correct. I thought it looked funny, but didn't take the time to look it up.

~Chris
04/19/2006 17:49 Doobs#6
Quote:
Originally posted by unknownone@Apr 19 2006, 14:57
No. where you have tibiaclint stick a vbnullstring, then put Conquer in the second arg.

FindWindow(vbnullstring, "[Conquer2.0]")

Arg1 takes a classname, second arg takes the window name.
Smartarse :rolleyes:
04/19/2006 19:12 Chanceler#7
Quote:
How about instead of "tibiaclient", try "[Conquer2.0]"

Shouldn't be doing such challenging code if you can't understand what it's doing.

~Chris
Tried it, doesn't work, gives me an error.


Quote:
No. where you have tibiaclint stick a vbnullstring, then put Conquer in the second arg.

FindWindow(vbnullstring, "[Conquer2.0]")

Arg1 takes a classname, second arg takes the window name.
I'll try it when I get home, thanks.


~Chanceler~
04/20/2006 16:03 toreddo#8
Hmm, i tried to do this but it doesnt work for me....
i just replaced the "FindWindow(vbnullstring, "[Conquer2.0]")"
is this good? i never used this function....
04/20/2006 16:39 unknownone#9
Quote:
Originally posted by toreddo@Apr 20 2006, 15:03
Hmm, i tried to do this but it doesnt work for me....
i just replaced the "FindWindow(vbnullstring, "[Conquer2.0]")"
is this good? i never used this function....
You need to declare all teh functions and constants you use.

Code:
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long
Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpNewBytes As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpNewBytes As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long

Const PROCESS_VM_READ = &H10
Const PROCESS_VM_WRITE = &H20
Const PROCESS_ALL_ACCESS = &H1F0FFF
Then make sure you're reading the right address.
04/20/2006 16:56 toreddo#10
Hm... still not working :(
here's my code:
Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, 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
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpNewBytes As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpNewBytes As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long

Const PROCESS_VM_READ = &H10
Const PROCESS_VM_WRITE = &H20
Const PROCESS_ALL_ACCESS = &H1F0FFF

'' THE COMMAND BUTTON
Private Sub Command1_Click()
Call open_conq
End Sub

''THE FUNCTION
Public Function open_conq()
 Dim conqclient As Long
 conqclient = FindWindow(vbNullString, "[Conquer2.0]")
 open_conq = conqclient
End Function
04/20/2006 17:34 unknownone#11
Quote:
Originally posted by toreddo@Apr 20 2006, 15:56
Hm... still not working :(
here's my code:
Whats wrong with that? Works fine. Next step you just need to read memory for whatever address you want. The function Memory_ReadLong wors for that, you just pass the handle for conquer and the adress you want to read.

for example if i wanted to read my player ID from an active conquer window, i just call

PlayerID = Memory_ReadLong(open_conq(), &H57b418)
04/20/2006 21:33 toreddo#12
Quote:
Originally posted by unknownone+Apr 20 2006, 17:34--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (unknownone @ Apr 20 2006, 17:34)</td></tr><tr><td id='QUOTE'> <!--QuoteBegin--toreddo@Apr 20 2006, 15:56
Hm... still not working :(
here's my code:
Whats wrong with that? Works fine. Next step you just need to read memory for whatever address you want. The function Memory_ReadLong wors for that, you just pass the handle for conquer and the adress you want to read.

for example if i wanted to read my player ID from an active conquer window, i just call

PlayerID = Memory_ReadLong(open_conq(), &H57b418) [/b][/quote]
Well i tried the whol evening now, but i just dont get it work :S
is there a tutorial or something for this, because i need this very well...

And with TSearch you can find addresses right?
04/21/2006 19:32 Doobs#13
Quote:
Originally posted by toreddo+Apr 20 2006, 21:33--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (toreddo @ Apr 20 2006, 21:33)</td></tr><tr><td id='QUOTE'>
Quote:
Originally posted by -unknownone@Apr 20 2006, 17:34
<!--QuoteBegin--toreddo
Quote:
@Apr 20 2006, 15:56
Hm... still not working :(
here's my code:

Whats wrong with that? Works fine. Next step you just need to read memory for whatever address you want. The function Memory_ReadLong wors for that, you just pass the handle for conquer and the adress you want to read.

for example if i wanted to read my player ID from an active conquer window, i just call

PlayerID = Memory_ReadLong(open_conq(), &H57b418)
Well i tried the whol evening now, but i just dont get it work :S
is there a tutorial or something for this, because i need this very well...

And with TSearch you can find addresses right? [/b][/quote]
yup, tsearch is good for finding address quickly