pal 9.4 send text

You can talk about VB programming here

pal 9.4 send text

Postby jimmyng » Fri Mar 14, 2008 1:15 pm


hi

how to send text to pal 9.4 it doen't work with old code

please share to me


thanks
jimmyng
imFiles Newbie
imFiles Newbie
 
Posts: 28
Joined: Sun Feb 12, 2006 4:41 pm

Re: pal 9.4 send text

Postby locohacker » Fri Mar 14, 2008 10:46 pm

umm which code ya using, cause i try the one I use for paltalk 9.2 and it works this one I mean :swift:
Code: Select all
Sub RoomSend(Text As String)
Dim parent, child, alt, rich20 As Long
parent = FindWindow("DlgGroupChat Window Class", vbNullString)
child = FindWindowEx(parent, 0, "WTL_SplitterWindow", vbNullString)
child = FindWindowEx(child, 0, "WTL_SplitterWindow", vbNullString)
child = FindWindowEx(child, 0, "WTL_SplitterWindow", vbNullString)
child = FindWindowEx(child, 0, "WTL_SplitterWindow", vbNullString)
alt = GetWindow(child, GW_Child)
alt = GetWindow(alt, GW_HWNDNEXT)
alt = FindWindowEx(alt, 0, "atlaxwin71", vbNullString)
alt = FindWindowEx(alt, 0, "#32770", vbNullString)
rich20 = FindWindowEx(alt, 0, "RichEdit20A", vbNullString)
rich20 = FindWindowEx(alt, rich20, "RichEdit20A", vbNullString)
Call SendMessageSTRING(rich20, WM_SETTEXT, 0&, Text$)
Call SendMessageLong(rich20, WM_KEYDOWN, 13, 0&)
End Sub

And to call it in the form use this
Code: Select all
Call RoomSend(RichTextBox1.TextRTF)

And on the module add this
Code: Select all
Option Explicit
Public Declare Function INIWRITE Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Public Declare Function INIGET Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public Declare Function EnumWindows& Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long)
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long
Public Declare Function IsWindowVisible& Lib "user32" (ByVal hWnd As Long)
Public Declare Function GetParent& Lib "user32" (ByVal hWnd As Long)
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function SendMessageLong& Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long)
Public Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public 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 SendMessageSTRING Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Public Const WM_GETTEXTLENGTH = &HE
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONUP = &H202
Public Const WM_SETTEXT = &HC
Public Const WM_GETTEXT = &HD
Private Const WM_KEYDOWN = &H100
Private Const HTCAPTION = 2
Dim sPattern As String, hFind As Long
Public Const GW_Child As Long = 5
Private Const GW_HWNDNEXT = 2
User avatar
locohacker
Site Admin
Site Admin
 
Posts: 4325
Joined: Fri Dec 31, 2004 6:59 pm

Re: pal 9.4 send text

Postby jimmyng » Sat Mar 15, 2008 5:46 am

hi

i tried the code it work for 9.2 but not work for 9.4 i still don't know why

any idea ??pls

thanks
jimmyng
imFiles Newbie
imFiles Newbie
 
Posts: 28
Joined: Sun Feb 12, 2006 4:41 pm

Re: pal 9.4 send text

Postby locohacker » Sat Mar 15, 2008 10:21 am

Umm aigh lets see you don't get any errors and how it does not work does the text not appear on the chat rooms, if ya want i can take a quick look at ya code if ya want :swift:
User avatar
locohacker
Site Admin
Site Admin
 
Posts: 4325
Joined: Fri Dec 31, 2004 6:59 pm

Re: pal 9.4 send text

Postby String » Mon Mar 17, 2008 2:41 am

If you are using AutoPilots method (and you really should), You just need to set up some code for 9.4 and set the Const SendTxtIndex to 2 for the current beta.
String
imFiles Senior
imFiles Senior
 
Posts: 282
Joined: Mon Mar 10, 2008 7:06 am

Re: pal 9.4 send text

Postby locohacker » Thu Mar 20, 2008 3:24 pm

Hey string where is Const SendTxtIndex
i am trying to updates the A1 program tha auto made for me :) ah here the module where the Roomsend is to send the text, and i dont find it :roll:
Code: Select all
Option Explicit
Public Declare Function INIWRITE Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Public Declare Function INIGET Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public Declare Function EnumWindows& Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long)
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long
Public Declare Function IsWindowVisible& Lib "user32" (ByVal hWnd As Long)
Public Declare Function GetParent& Lib "user32" (ByVal hWnd As Long)
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function SendMessageLong& Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long)
Public Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public 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 SendMessageSTRING Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long

Public Declare Function EnableWindow Lib "user32" (ByVal hWnd As Long, ByVal fEnable As Long) As Long

Public Const EM_SETSEL = 177
Public Const EM_GETSEL = 176
Public Const WM_CUT = 768
Public Const WM_PASTE = 770

Public Const WM_GETTEXTLENGTH = &HE
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONUP = &H202
Public Const WM_SETTEXT = &HC
Public Const WM_GETTEXT = &HD
Private Const WM_KEYDOWN = &H100
Private Const HTCAPTION = 2
Dim sPattern As String, hFind As Long
Public Const GW_Child As Long = 5
Private Const GW_HWNDNEXT = 2
Sub RoomSend(Text As String)
    Dim iHnd As Long
    Dim res&, sel&, start_pos&, end_pos&, txt_len&
    iHnd = getPalSubForm(Form1.WindowClass, Form1.Combo1.Text, Form1.RoomOutboundTextBoxClass, Form1.SendTxtIndex)
       
    'disable editing, may not be needed
    Call EnableWindow(iHnd, 0)
    'Copy Text that has been typed in if any
    txt_len& = SendMessage(iHnd, WM_GETTEXTLENGTH, 0, 0)
    If txt_len& > 0 Then ' don't need all this if user not typing
        ' save user selection / cursor position
        Call SendMessage(iHnd, EM_GETSEL, ByVal VarPtr(start_pos&), ByVal VarPtr(end_pos&))
        ' select all text and cut
        res = SendMessage(iHnd, EM_SETSEL, 0, ByVal txt_len&)
        res = SendMessage(iHnd, WM_CUT, 0, 0)
    End If
    Call SendMessageSTRING(iHnd, WM_SETTEXT, 0&, Text$)
    Call SendMessageLong(iHnd, WM_KEYDOWN, 13, 0&)
        'Send any typing back to box
    If txt_len& > 0 Then
        ' text box is empty, paste saved text
        res& = SendMessage(iHnd, WM_PASTE, 0, 0)
        ' restore selection / cursor position
        res& = SendMessage(iHnd, EM_SETSEL, start_pos&, ByVal end_pos&)
    End If
    'enable editing
    Call EnableWindow(iHnd, 1)
End Sub
   
Private Function getPalSubForm(ByVal TargetWinClass As String, _
    ByVal TargetWinCaption As String, ByVal TargetSubClass As String, _
    ByVal TargetSubClassIndex As Integer) As Long
    'set variables in module
    mTargetWinClass = TargetWinClass
    mTargetWinCaption = TargetWinCaption
    mTargetSubClass = TargetSubClass
    mTargetSubClassIndex = TargetSubClassIndex
    'set variables for EnumWindows function
    Dim lRet As Long
    Dim lParam As Long
    'Enum sub windows to get hnd for target
    lRet = EnumWindows(AddressOf FindSubWinds, lParam)
    'return target hnd
    getPalSubForm = mSubFormHnd
End Function
User avatar
locohacker
Site Admin
Site Admin
 
Posts: 4325
Joined: Fri Dec 31, 2004 6:59 pm

Re: pal 9.4 send text

Postby Chike » Thu Mar 20, 2008 4:15 pm

locohacker wrote:Hey string where is Const SendTxtIndex

SendTxtIndex9, but you'll need to make a new one and change SetPalVer9 ReadPalVersion and whatever sub is calling them if you want them to work with pal 9.1 & 9.2.
Image
Chike
imFiles Master
imFiles Master
 
Posts: 581
Joined: Sun May 13, 2007 6:20 pm

Re: pal 9.4 send text

Postby locohacker » Thu Mar 20, 2008 10:51 pm

Aigh so you mean I should play with this part of the code :roll:
Code: Select all
 ' PalTalk v9
 Const WindowClass9 As String = "DlgGroupChat Window Class" ' PalTalk v9
 Const RoomOutboundTextBoxClass9 As String = "RichEdit20A" ' PalTalk v9
 Const SysListCtrlClass9 As String = "SysListView32" ' PalTalk v9
 Const BounceReasonTextBoxClass9 As String = "Edit" ' PalTalk v9
 Const BounceButtonClass9 As String = "Button" ' PalTalk v9
 Const BounceClass9 As String = "#32770" ' PalTalk v9
 Const ChaTxtIndex9 As Integer = 4 ' PalTalk v9
 Const NicListIndex9 As Integer = 1 ' All Pal Versions
 Const SendTxtIndex9 As Integer = 3 ' All Pal Versions
 Const BounceTextIndex9 As Integer = 1 ' All Pal Versions
 Const BounceCloseIndex9 As Integer = 1 ' All Pal Versions
 Const BannerClass9 As String = "Internet Explorer_Server"

I'm thinking I should ask auto to update it for me lol and stay lazy :swift:
User avatar
locohacker
Site Admin
Site Admin
 
Posts: 4325
Joined: Fri Dec 31, 2004 6:59 pm

Re: pal 9.4 send text

Postby String » Fri Mar 21, 2008 12:33 am

Code: Select all
Const SendTxtIndex9 As Integer = 3 ' for pal9.1,2,3
'This index changes to "2" for pal9.4(beta)

And as Chike stated, you'll need to change Sub ReadPalVersion and Sub SetPalVer9 to read the 9.4(beta)
String
imFiles Senior
imFiles Senior
 
Posts: 282
Joined: Mon Mar 10, 2008 7:06 am

Re: pal 9.4 send text

Postby autopilot » Fri Mar 21, 2008 8:58 am

i have started using properties to set pal version variables. The attached project is a VB 2005 project.

it uses System.Diagnostics.FileVersionInfo to read the file version of the paltalk.exe.
Code: Select all
    Private _PalMajorVer As Integer
    Public ReadOnly Property PalMajorVer() As Integer
        Get
            If _PalMajorVer = 0 Then
                Try
                    If mdlPalInfo.PalPath <> "Not Found" Then
                        'This reads the file version information
                        ' Paltalk calls this the Application version
                        ' if you look in the About Pal window
                        Dim VersionInfo As System.Diagnostics.FileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(mdlPalInfo.PalPath & "\paltalk.exe")
                        _PalMajorVer = VersionInfo.ProductMajorPart
                        _PalMinorVer = VersionInfo.ProductMinorPart
                    Else
                        _PalMajorVer = 0
                    End If
                Catch
                    _PalMajorVer = 0
                End Try
            End If
            Return _PalMajorVer
        End Get
    End Property

    Private _PalMinorVer As Integer
    Public ReadOnly Property PalMinorVer() As Integer
        Get
            If _PalMinorVer = 0 Then
                Try
                    If mdlPalInfo.PalPath <> "Not Found" Then
                        'This reads the file version information
                        ' Paltalk calls this the Application version
                        ' if you look in the About Pal window
                        Dim VersionInfo As System.Diagnostics.FileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(mdlPalInfo.PalPath & "\paltalk.exe")
                        _PalMinorVer = VersionInfo.ProductMinorPart
                    Else
                        _PalMinorVer = 0
                    End If
                Catch
                    _PalMinorVer = 0
                End Try
            End If
            Return _PalMinorVer
        End Get
    End Property
Attachments
PalVersionDemo.zip
detect pal version & set variables
(509.5 KiB) Downloaded 140 times
User avatar
autopilot
Forum Moderator
Forum Moderator
 
Posts: 356
Joined: Sat Sep 23, 2006 7:19 pm

Re: pal 9.4 send text

Postby autopilot » Fri Mar 21, 2008 9:03 am

just noticed an error in the project posted above...
Code: Select all
    Private _SendTextIndex As Integer
    Public ReadOnly Property SendTextIndex() As Integer
        Get
            If _SendTextIndex = 0 Then
                If PalMajorVer = 9 Then
                    Select Case PalMinorVer
                        Case Is > 91
                            _SendTextIndex = 4
                        Case Else
                            _SendTextIndex = 3
                    End Select
                Else
                    _SendTextIndex = 3
                End If
            End If
            Return _SendTextIndex
        End Get
    End Property

needs to be
Code: Select all
    Private _SendTextIndex As Integer
    Public ReadOnly Property SendTextIndex() As Integer
        Get
            If _SendTextIndex = 0 Then
                If PalMajorVer = 9 Then
                    Select Case PalMinorVer
                        Case Is > 91
                            _SendTextIndex = 2
                        Case Else
                            _SendTextIndex = 3
                    End Select
                Else
                    _SendTextIndex = 3
                End If
            End If
            Return _SendTextIndex
        End Get
    End Property
User avatar
autopilot
Forum Moderator
Forum Moderator
 
Posts: 356
Joined: Sat Sep 23, 2006 7:19 pm

Re: pal 9.4 send text

Postby locohacker » Fri Mar 21, 2008 9:54 am

Thanks man I gonna check it out next week :)
Hey one thing I am getting a free copy of VB 2008 from microsoft cause I am a student :) now would codes in 2005 be much different to 2008 and which version would you recomend since I can get both :?:
Thanks
User avatar
locohacker
Site Admin
Site Admin
 
Posts: 4325
Joined: Fri Dec 31, 2004 6:59 pm

Re: pal 9.4 send text

Postby Chike » Fri Mar 21, 2008 11:08 am

locohacker wrote:would codes in 2005 be much different to 2008 and which version would you recomend since I can get both

Probably exactly the same, get the latest.
Image
Chike
imFiles Master
imFiles Master
 
Posts: 581
Joined: Sun May 13, 2007 6:20 pm

Re: pal 9.4 send text

Postby autopilot » Fri Mar 21, 2008 5:08 pm

locohacker wrote:now would codes in 2005 be much different to 2008 and which version would you recomend

I have not used VB 2008 yet, but would think that you would be better off with the latest. Most of the 2005 code should be able to be converted without any problems (VB 2008 has a built in code upgrade utility).
User avatar
autopilot
Forum Moderator
Forum Moderator
 
Posts: 356
Joined: Sat Sep 23, 2006 7:19 pm

Re: pal 9.4 send text

Postby String » Sat Mar 22, 2008 8:58 pm

While testing with some friends today, I came across somthing that I hadnt expected. The send code for 9.3 will work fine with 9.4 without modification,,, but only for nics that are not black. The old code seems to work fine with blue, green and etc nics. The modified code for 9.4 does work for black nics but I do not know if it works for blue, green etc.
Anyone else notice this? Is there a way, programatically, to determine what color of nic the end-user is using? Or am I overlooking something.
String
imFiles Senior
imFiles Senior
 
Posts: 282
Joined: Mon Mar 10, 2008 7:06 am

Next

Return to Visual Basic Programming

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests