
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 SubCall RoomSend(RichTextBox1.TextRTF)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




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
locohacker wrote:Hey string where is Const SendTxtIndex

' 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"

Const SendTxtIndex9 As Integer = 3 ' for pal9.1,2,3
'This index changes to "2" for pal9.4(beta) 
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
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 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

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

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


Return to Visual Basic Programming
Users browsing this forum: No registered users and 0 guests