What part to change to send text to diffrent textbox

You can talk about VB programming here

What part to change to send text to diffrent textbox

Postby method » Wed May 24, 2006 3:26 pm


Hi all .This code currently sends text to paltalk textbox. Could any one tell me what parts should i change in order to send text to diffrent textbox. Thanks


Code: Select all
Option Explicit
Public Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) 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
Public Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) 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 ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Public Const BM_SETCHECK = &HF1
Public Const BM_GETCHECK = &HF0

Public Const CB_GETCOUNT = &H146
Public Const CB_GETLBTEXT = &H148
Public Const CB_SETCURSEL = &H14E

Public Const GW_HWNDFIRST = 0
Public Const GW_HWNDNEXT = 2
Public Const GW_CHILD = 5

Public Const LB_GETCOUNT = &H18B
Public Const LB_GETTEXT = &H189
Public Const LB_SETCURSEL = &H186

Public Const SW_HIDE = 0
Public Const SW_MAXIMIZE = 3
Public Const SW_MINIMIZE = 6
Public Const SW_NORMAL = 1
Public Const SW_SHOW = 5

Public Const VK_SPACE = &H20

Public Const WM_CHAR = &H102
Public Const WM_CLOSE = &H10
Public Const WM_COMMAND = &H111
Public Const WM_GETTEXT = &HD
Public Const WM_GETTEXTLENGTH = &HE
Public Const WM_KEYDOWN = &H100
Public Const WM_KEYUP = &H101
Public Const WM_LBUTTONDBLCLK = &H203
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONUP = &H202
Public Const WM_MOVE = &HF012
Public Const WM_RBUTTONDOWN = &H204
Public Const WM_RBUTTONUP = &H205
Public Const WM_SETTEXT = &HC
Public Const WM_SYSCOMMAND = &H112
Sub RoomSend(Text As String)
Dim mywindowclass As Long
Dim wtlsplitterwindow As Long
Dim atld As Long
Dim atlaxwin As Long
Dim x As Long
Dim richedita As Long
Dim Button 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)
atld = FindWindowEx(wtlsplitterwindow, 0&, "atl:0053d798", vbNullString)
atlaxwin = FindWindowEx(atld, 0&, "atlaxwin71", vbNullString)
x = FindWindowEx(atlaxwin, 0&, "#32770", vbNullString)
richedita = FindWindowEx(x, 0&, "richedit20a", vbNullString)
richedita = FindWindowEx(x, richedita, "richedit20a", vbNullString)
Call SendMessageByString(richedita, WM_SETTEXT, 0&, Text$)

If richedita = 0 Then
 
    Exit Sub
End If

Do
    DoEvents
   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)
atld = FindWindowEx(wtlsplitterwindow, 0&, "atl:0053d798", vbNullString)
atlaxwin = FindWindowEx(atld, 0&, "atlaxwin71", vbNullString)
x = FindWindowEx(atlaxwin, 0&, "#32770", vbNullString)
richedita = FindWindowEx(x, 0&, "richedit20a", vbNullString)
    richedita = FindWindowEx(x, richedita, "richedit20a", vbNullString)
    Call SendMessageLong(richedita, WM_KEYDOWN, 13, 0&)
Loop Until richedita <> 0
End Sub
method
imFiles Master
imFiles Master
 
Posts: 686
Joined: Tue Oct 18, 2005 11:12 am

Postby null » Wed May 24, 2006 4:05 pm

This you wanna call i dont have vb install i formated and its something like....


Call RoomSend (RichTextBox1.Text)

i think....


If you have like 5 RichTextBoxs and you wanna use like ohhhhh RichTextBox4 you would do...

Call RoomSend (RichTextBox4.Text)

you can put this ina timer, label, command button ect...

that code use use i believe it has to use the richtextbox component...
null
 

Postby method » Wed May 24, 2006 4:10 pm

Dim ZaraByte As String wrote:This you wanna call i dont have vb install i formated and its something like....


Call RoomSend (RichTextBox1.Text)

i think....


If you have like 5 RichTextBoxs and you wanna use like ohhhhh RichTextBox4 you would do...

Call RoomSend (RichTextBox4.Text)

you can put this ina timer, label, command button ect...

that code use use i believe it has to use the richtextbox component...



Well how to change it to send text for example to search textbox of paltalk or login textbox . It should be easy for some one who done it before. I tried to do some changes but no luck!! Hope i get this working with some help.Thanks
method
imFiles Master
imFiles Master
 
Posts: 686
Joined: Tue Oct 18, 2005 11:12 am

Postby BattleStar-Galactica » Wed May 24, 2006 7:33 pm

method the easy way for you is using spy++ to get the structure of window you want to send text too. and try to understand what it does the api function FindWindow and FindWindowEx

if you don't understand these two functions, I doubt you cannot go so far.
User avatar
BattleStar-Galactica
imFiles Master
imFiles Master
 
Posts: 565
Joined: Tue Sep 20, 2005 12:19 am
Location: safest place to hide

Postby method » Wed May 24, 2006 7:58 pm

well the code is working but i just want to to change the target to diffrent richtextbox or textbox . That is why i ask for turorial i could not find any on the net!!!
method
imFiles Master
imFiles Master
 
Posts: 686
Joined: Tue Oct 18, 2005 11:12 am

Postby BattleStar-Galactica » Wed May 24, 2006 8:26 pm

that code it's not magic, it cannot work with all window. You have to understand FindWindow and FindWindowEx and explorer yourself with window structure you want to send the text to.

these three basic things it's the basic for making a programm for pt
User avatar
BattleStar-Galactica
imFiles Master
imFiles Master
 
Posts: 565
Joined: Tue Sep 20, 2005 12:19 am
Location: safest place to hide

Postby BattleStar-Galactica » Wed May 24, 2006 8:44 pm

and if you want to know what part of that code settext to the window here it.
Call SendMessageByString(richedita, WM_SETTEXT, 0&, "yourtext")

when you call that function it will set you text to that window. richedita is the window handle of edit control. and when you call this function bellow

Call SendMessageLong(richedita, WM_KEYDOWN, 13, 0&)

that will execute like when you press on enter key on that window
User avatar
BattleStar-Galactica
imFiles Master
imFiles Master
 
Posts: 565
Joined: Tue Sep 20, 2005 12:19 am
Location: safest place to hide

Postby method » Wed May 24, 2006 8:46 pm

problem is that i do not know how to find the window and how to what properits of textbox i need to use and where !!!
method
imFiles Master
imFiles Master
 
Posts: 686
Joined: Tue Oct 18, 2005 11:12 am

Postby BattleStar-Galactica » Wed May 24, 2006 9:09 pm

nanomachine007 wrote:method the easy way for you is using spy++ to get the structure of window you want to send text too. and try to understand what it does the api function FindWindow and FindWindowEx



nanomachine007 wrote:that code it's not magic, it cannot work with all window. You have to understand FindWindow and FindWindowEx and explorer yourself with window structure you want to send the text to
User avatar
BattleStar-Galactica
imFiles Master
imFiles Master
 
Posts: 565
Joined: Tue Sep 20, 2005 12:19 am
Location: safest place to hide


Return to Visual Basic Programming

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests