|
-
May 13th, 2000, 01:39 PM
#1
Thread Starter
Member
How can I get my program to Click a certain button on another program or window?
ALSO I need help with this..
lets say text1.text = "Hello Person"
How can i change it?
For Example.
when the program is running i want to be able to add a symbol like - in it so text1.text will = "Hello-Person"
I know the user can easily add anything to it but how would the program?
see what i mean?
-Jeff
Using VB 6.0 Enterprise
I Still like to program on my TI-85!
-
May 13th, 2000, 01:50 PM
#2
Public Declare Function sendmessagebynum& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long)
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 Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONUP = &H202
Sub Click(Wh)
DoEvents
X = sendmessagebynum(Wh, WM_LBUTTONDOWN, 0, 0&)
X = sendmessagebynum(Wh, WM_LBUTTONUP, 0, 0&)
End Sub
First you need to find the window and the button:
Dim thunderform&
Dim thundercommandbutton&
thunderform& = FindWindow("thunderform", vbNullString) 'Find the Window
thundercommandbutton& = FindWindowEx(thunderform&, 0&, "thundercommandbutton", vbNullString) 'Find the button
thundercommandbutton& = FindWindowEx(thunderform&, thundercommandbutton&, "thundercommandbutton", vbNullString)
Than click it:
Call Click(thundercommandbutton&)
And what do you mean for the text1.text = "Hello Person"? Change it if the textbox is on a whole other program?
[Edited by Matthew Gates on 05-14-2000 at 02:51 AM]
[Edited by Matthew Gates on 05-14-2000 at 02:53 AM]
-
May 13th, 2000, 02:02 PM
#3
Thread Starter
Member
i want to be able to click the "Dial" button with my program on Phone Dialer.
What i mean about text1.text thing is...
I have a save option on my program to save phone numbers but if i add the - between the letters it wont work right. EXAMPLE:
"save" is the save code
a= save 972-111-1111
text1.text = a
when loaded text1.text will equal 972
the - blocks it off
so i wana be able to save the number as 9721111111 and save it to text1.text which i can do but i want the program to add in the -'s after its been loaded
text1.text = 9721111111
then user puts mouse on program and it changes to:
text1.text = 972-111-1111
i just made up the number
any ideas?
-Jeff
Using VB 6.0 Enterprise
I Still like to program on my TI-85!
-
May 13th, 2000, 02:06 PM
#4
when you save it..are you saving writing to an ini file? What is your code to saving it?
-
May 13th, 2000, 02:10 PM
#5
Thread Starter
Member
Save Code:
Dim a$(), ff%, n%: ReDim a(0)
ff = FreeFile
Open "C:\windows\desktop\MyFile.txt" For Input As ff
Do
ReDim Preserve a(UBound(a) + 1)
Input #ff, a(UBound(a) - 1)
Loop Until EOF(ff)
Close ff
ReDim Preserve a(UBound(a) - 1)
a(0) = text1
ff = FreeFile
Open "C:\windows\desktop\MyFile.txt" For Output As ff
For n = 0 To UBound(a)
Print #ff, a(n)
Next n
Close ff
What do you mean by "Thunderform" ??
-Jeff
Using VB 6.0 Enterprise
I Still like to program on my TI-85!
-
May 13th, 2000, 02:12 PM
#6
Thread Starter
Member
My save code is perfect! I just need to be able to add the - on mouse move
-Jeff
Using VB 6.0 Enterprise
I Still like to program on my TI-85!
-
May 13th, 2000, 02:22 PM
#7
Use this code:
Dim fFile As Integer
a = "save 972-111-1111"
text1.text = a
fFile = FreeFile
Open "C:\myapp\number.txt" For Output As fFile
Print #fFile, Text1.Text
Close fFile
It works.
Thunderform is just the name for the command button, don't worry bout that.
Use a Windows API Spy to get window handles and stuff.
Hope that helps.
[Edited by Matthew Gates on 05-14-2000 at 03:54 AM]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|