How To Get Text From PalTalk

You can talk about VB programming here

How To Get Text From PalTalk

Postby Johnny5 » Thu Mar 24, 2005 1:59 am


Hello all,

I'm new here, just need some help on how to get text from the chatbox (RichEdit20A) window "#32770" old paltalk version. How to get a command trigger like "!" ?

Thank Adavance,
Johnny5
imFiles Junior
imFiles Junior
 
Posts: 72
Joined: Wed Dec 29, 2004 7:16 pm

Postby Johnny5 » Thu Mar 24, 2005 2:43 pm

Will This Works? I've try it but no sign :roll:


Function LastChatLineWithSN()
On Error Resume Next
Dim LastLine
Dim lastlen
Dim TheChatText As String
Dim TheChars As String
Dim TheChar As String
Dim FindChar
Dim ChatText As String
ChatText$ = GetChatText
For FindChar = 1 To Len(ChatText$)
TheChar$ = Mid(ChatText$, FindChar, 1)
TheChars$ = TheChars$ & TheChar$
If TheChar$ = Chr(13) Then
TheChatText$ = Mid(TheChars$, 1, Len(TheChars$) - 1)
Form1.Text1.text = TheChatText$
TheChars$ = ""
End If
Next FindChar
lastlen = Val(FindChar) - Len(TheChars$)
LastLine = Mid(ChatText$, lastlen, Len(TheChars$))
LastChatLineWithSN = LastLine
End Function



Function LastChatLine()
On Error Resume Next
Dim ChatTrim As String
Dim ChatTrimNum
Dim ChatText
ChatText = LastChatLineWithSN
ChatTrimNum = Len(SNFromLastChatLine)
ChatTrim$ = Mid$(ChatText, ChatTrimNum + 4, Len(ChatText) - Len(SNFromLastChatLine))
LastChatLine = ChatTrim$
End Function
Public Function GetText(WinHandle As Long) As String
Dim abc As String, TxtLength As Long
TxtLength& = SendMessage(WinHandle&, WM_GETTEXTLENGTH, 0&, 0&)
abc$ = String(TxtLength&, 0&)
Call SendMessageByString(WinHandle&, WM_GETTEXT, TxtLength& + 1, abc$)
GetText$ = abc$
End Function



Function GetChatText()
On Error Resume Next
Dim ChatText
Dim AORich As Long
Dim Room As Long
Call GetPalWindow
Dim sp1 As Long
Dim sp2 As Long
sp1 = FindWindow("#32770", strWindowTitle)
sp1 = FindWindowEx(sp1, 0, "#32770", vbNullString)
sp2 = FindWindowEx(sp1, 0, "RichEdit20A", vbNullString)
sp2 = FindWindowEx(sp1, sp2, "RichEdit20A", vbNullString)
sp2 = FindWindowEx(sp1, sp2, "RichEdit20A", vbNullString)
sp2 = FindWindowEx(sp1, sp2, "RichEdit20A", vbNullString)
ChatText = GetText(sp2)
GetChatText = ChatText
End Function


Public Function GetText1(Get_hWnd As Long) As String
On Error Resume Next
Dim retVal As Long, lenTxt As Integer, retText As String
lenTxt = SendMessageLong(Get_hWnd, WM_GETTEXTLENGTH, 0&, 0&)
retText = String(lenTxt + 1, " ")
Call SendMessageByString(Get_hWnd, WM_GETTEXT, lenTxt + 1, retText)
GetText1 = Left(retText, lenTxt)
End Function
Johnny5
imFiles Junior
imFiles Junior
 
Posts: 72
Joined: Wed Dec 29, 2004 7:16 pm

Postby UDG_Sk8erboi4490 » Sat Apr 02, 2005 12:47 am

tell yah what, ill find the coding from me age checker from 553, gets room anme if thats what uw ant
UDG_Sk8erboi4490
imFiles Senior
imFiles Senior
 
Posts: 112
Joined: Fri Apr 01, 2005 10:36 pm

Postby Departure » Sun Apr 03, 2005 7:56 am

hmm notice how so many people use the window handel #32770, i am sure everyone is aware that alot of programs also have this window handel, so in other words if you have an app runing the same time as your paltalk and say for example it uses the same window handel #32770 and is on top of paltalk you are going to run into some trouble.... But the good news is there is a way to fix this and should be used at all times (in my option)... and that is by using a wild card, for example we all know that paltalk room all end with "Voice Conference" so the wild card would be *Voice Conference, as as that and now the code to help find that wild card :O(

BTW this is for older version paltalk and you will have to subclass it to suit the newer version, wich is easy using a good API spy like PAT and JK's API spy.. anyway the code

Public Function Palsend(Sendit As String)
Dim PaltalkHwnd As Long
Dim PaltalkEdit As Long
Dim SendKey As Long
Dim Palb As Long
PaltalkHwnd = FindWindowWild("*Voice Conference", False)
PaltalkEdit = FindWindowEx(PaltalkHwnd, 0&, "RichEdit20A", vbNullString)
PaltalkEdit = FindWindowEx(PaltalkHwnd, PaltalkEdit, "RichEdit20A", vbNullString)
Call SendMessageByString(PaltalkEdit, WM_SETTEXT, 0, Sendit$)
If PaltalkEdit = 0 Then
MsgBox (".::Paltalk Room is not open::.")
End
Exit Function
End If
Do
DoEvents
PaltalkHwnd = FindWindowWild("Voice Confrence", False)
Palb = FindWindowEx(PaltalkHwnd, 0&, "PALBUTTON", vbNullString)
Palb = FindWindowEx(PaltalkHwnd, Palb, "PALBUTTON", vbNullString)
Palb = FindWindowEx(PaltalkHwnd, Palb, "PALBUTTON", vbNullString)
Call SendMessageLong(Palb, WM_LBUTTONDOWN, 0&, 0&)
Call SendMessageLong(Palb, WM_LBUTTONUP, 0&, 0&)
If Palb = 0 Then
MsgBox ".::Palbutton error::."
End
Exit Function
End If
Loop Until Palb <> 0
End Function
Function EnumWinProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim k As Long, sName As String
If IsWindowVisible(hwnd) And GetParent(hwnd) = 0 Then
sName = Space$(128)
k = GetWindowText(hwnd, sName, 128)
If k > 0 Then
sName = Left$(sName, k)
If lParam = 0 Then sName = UCase(sName)
If sName Like sPattern Then
hFind = hwnd
EnumWinProc = 0
Exit Function
End If
End If
End If
EnumWinProc = 1
End Function

Public Function FindWindowWild(sWild As String, Optional bMatchCase As Boolean = True) As Long
sPattern = sWild
If Not bMatchCase Then sPattern = UCase(sPattern)
EnumWindows AddressOf EnumWinProc, bMatchCase
FindWindowWild = hFind
End Function

Ofcause you have to also Publicl declare funtions,

Hope this method helps someone, it has worked great for me and i have never ran into
trouble finding the correct object handel
User avatar
Departure
Global Moderator
Global Moderator
 
Posts: 996
Joined: Thu Mar 17, 2005 11:26 am
Location: Australia

Postby locohacker » Sun Apr 03, 2005 1:43 pm

Thanks Departure this should work with paltalk 8 too after little tweaking, I was looking for this type of code to connect to the paltalk room, since the old method paltalk disable it somehow :(
User avatar
locohacker
Site Admin
Site Admin
 
Posts: 4363
Joined: Fri Dec 31, 2004 6:59 pm

Postby Departure » Mon Apr 04, 2005 1:44 am

Yeap it does work with paltalk 8 as i have already subclassed it, and it works with out a problem :O)
User avatar
Departure
Global Moderator
Global Moderator
 
Posts: 996
Joined: Thu Mar 17, 2005 11:26 am
Location: Australia

Postby locohacker » Mon Apr 04, 2005 9:05 am

Thas great :)
User avatar
locohacker
Site Admin
Site Admin
 
Posts: 4363
Joined: Fri Dec 31, 2004 6:59 pm


Return to Visual Basic Programming

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests