Using JK's API SPY

Here you will find tutorials that will help you with programming.

Postby autopilot » Sun Nov 12, 2006 4:44 pm


If you forget about the API calls fo a moment, what you must do is find the handle of the text box to send your message to. To ensure that you post to the right text box (a big consideration if you have more then one paltalk window open), you find the handel for the main chat window that you are working with (room box or pm box). Then you enum through the children untill you find the text box. Once you have that handle, you are able to sendmessage to it.
That being said, you have to have a way to find the handles to the different forms and controls on the forms. If you are not used to using api's, this program is a nice helper to give you the code example with relitive values. So if you open the api spy tool, and click on the Code Generator tab, then drag the yellow dot onto the frame or title bar of the chat room window (not the body of the form), it will generate the code that has the class name already filled in.
Pal 8.x
Code: Select all
Dim mywindowclass As Long
mywindowclass = FindWindow("my window class", vbNullString)
Pal 9.x
Code: Select all
Dim dlggroupchatwindowclass As Long
dlggroupchatwindowclass = FindWindow("dlggroupchat window class", vbNullString)

The reason for the difference is that in paltalk 9 they changed the class name of the chat windows. This is why the programs that worked with pal8 dont work with pal9.

autopilot

By the way, any one else here using VS2005? I am in need of help inserting into paltalk memory space to read the syslistview32 control. But that is another post i guess.
User avatar
autopilot
Forum Moderator
Forum Moderator
 
Posts: 358
Joined: Sat Sep 23, 2006 7:19 pm

Postby BattleStar-Galactica » Sun Nov 12, 2006 5:22 pm

autopilot wrote:If you forget about the API calls fo a moment, what you must do is find the handle of the text box to send your message to. To ensure that you post to the right text box (a big consideration if you have more then one paltalk window open), you find the handel for the main chat window that you are working with (room box or pm box). Then you enum through the children untill you find the text box. Once you have that handle, you are able to sendmessage to it.
That being said, you have to have a way to find the handles to the different forms and controls on the forms. If you are not used to using api's, this program is a nice helper to give you the code example with relitive values. So if you open the api spy tool, and click on the Code Generator tab, then drag the yellow dot onto the frame or title bar of the chat room window (not the body of the form), it will generate the code that has the class name already filled in.
Pal 8.x
Code: Select all
Dim mywindowclass As Long
mywindowclass = FindWindow("my window class", vbNullString)
Pal 9.x
Code: Select all
Dim dlggroupchatwindowclass As Long
dlggroupchatwindowclass = FindWindow("dlggroupchat window class", vbNullString)

The reason for the difference is that in paltalk 9 they changed the class name of the chat windows. This is why the programs that worked with pal8 dont work with pal9.

autopilot

By the way, any one else here using VS2005? I am in need of help inserting into paltalk memory space to read the syslistview32 control. But that is another post i guess.


dude you have to read this post and thing in that session cuz c#.net anh vbnet have something semilar

http://www.locohacker.net/paltalk/resolvedwidth-of-a-listview-control-vt2257.html
Big math problem
2 - 1 = 0 = without you I'm nothing
User avatar
BattleStar-Galactica
imFiles Master
imFiles Master
 
Posts: 565
Joined: Tue Sep 20, 2005 12:19 am
Location: safest place to hide

Postby Ponies » Sun Nov 12, 2006 6:17 pm

f**k you ghost.
Ponies
BANNED
BANNED
 
Posts: 5322
Joined: Sun Apr 30, 2006 8:59 am

Postby autopilot » Sun Nov 12, 2006 6:28 pm

nanomachine007 wrote: dude you have to read this post and thing in that session cuz c#.net anh vbnet have something semilar

That is what I have been looking for... thank you so much! I don't know how I missed it! Every post that I found elsewhere wanted to use C to make a dll to inject and then call... This is so much less complecated!

Thanks again

Sorry I hijacked the thread

autopilot
User avatar
autopilot
Forum Moderator
Forum Moderator
 
Posts: 358
Joined: Sat Sep 23, 2006 7:19 pm

Postby NinjaCoder » Sun Nov 12, 2006 6:42 pm

OK this is the code i did....i think i understand now.....but it doesnt work...can u tell me why? its for 8.5 build 157.

Code: Select all
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function SendMessageSTRING Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const GW_CHILD = 5
Private Const GW_HWNDNEXT = 2
Private Const WM_GETTEXT = &HD
Private Const WM_GETTEXTLENGTH = &HE
Private Const WM_SETTEXT = &HC
Private Const WM_KEYDOWN = &H100


Code: Select all
Private Sub Command1_Click()
Dim wtlsplitterwindow As Long, atl As Long, atlaxwin As Long
Dim x As Long, richedita As Long
Dim mywindowclass As Long
mywindowclass = FindWindow("my window class", vbNullString)
wtlsplitterwindow = FindWindow("wtl_splitterwindow", vbNullString)
wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString)
wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString)
atl = FindWindowEx(wtlsplitterwindow, 0&, "atl:00546990", vbNullString)
atlaxwin = FindWindowEx(atl, 0&, "atlaxwin71", vbNullString)
x = FindWindowEx(atlaxwin, 0&, "#32770", vbNullString)
richedita = FindWindowEx(x, 0&, "richedit20a", vbNullString)
richedita = FindWindowEx(x, richedita, "richedit20a", vbNullString)
Call SendMessageSTRING(richedita, WM_SETTEXT, 0&, Text1.Text)
Call SendMessageLong(richedita, WM_KEYDOWN, 13, 0&)
End Sub
NinjaCoder
 

Postby autopilot » Sun Nov 12, 2006 9:01 pm

To tie this together, there is one thing you need to change in the button code
Code: Select all
Private Sub Command1_Click()
Dim wtlsplitterwindow As Long, atl As Long, atlaxwin As Long
Dim x As Long, richedita As Long
Dim mywindowclass As Long
mywindowclass = FindWindow("my window class", vbNullString)
wtlsplitterwindow = FindWindowEx(mywindowclass, 0&, "wtl_splitterwindow", vbNullString)
wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString)
wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString)
atl = FindWindowEx(wtlsplitterwindow, 0&, "atl:00545990", vbNullString)
atlaxwin = FindWindowEx(atl, 0&, "atlaxwin71", vbNullString)
x = FindWindowEx(atlaxwin, 0&, "#32770", vbNullString)
richedita = FindWindowEx(x, 0&, "richedit20a", vbNullString)
richedita = FindWindowEx(x, richedita, "richedit20a", vbNullString)
Call SendMessageSTRING(richedita, WM_SETTEXT, 0&, "The Zone is my home")
Call SendMessageLong(richedita, WM_KEYDOWN, 13, 0&)
End Sub

You must change the first line from the code generated for the textbox to link it to the handle for the main window.

Good luck getting a handle on the API calls.

autopilot
User avatar
autopilot
Forum Moderator
Forum Moderator
 
Posts: 358
Joined: Sat Sep 23, 2006 7:19 pm

Previous

Return to Programming Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests