|
||
|
|
#1 (permalink) |
|
Newbie
Join Date: Feb 2006
Posts: 13
|
Hello.. I'm new to the VB language. Other than creating Calculators, Converters, and Data forms from excel docs I'm clueless. Iv used RunUO for years and I'm egger to co-inside the to as a Custom 3rd party tool.
My main issue is Sending and Receiving Info from/to my running UO Client. Below is 2 examples of what I'm shotting to learn. Sending Exp: Lets say I have a Form named FrmSpeek, with in it a Command Button named CmdSend, and a Text Box named TxtSend. My goal being to type something in TxtSend and click on CmdSend, Thus sending the Text to my running UO client as speech (w/out the need to hit Enter on my client) Retrieving Exp: Let’s say I have a form named FrmFastCasting. With in it 3 Text Box.s named TxtNeckFC, TxtWristFC, and TxtTotalFC. Also a Command Button named CmdGet. My goal here is to click CmdGet display the current FC on my Neck and Wrist. Adding the two together getting the Total FC. I know this an stupid silly thing to ask the pro's but its something that would realy help me out alot. Thanks |
|
|
|
|
|
#3 (permalink) |
|
Newbie
Join Date: Feb 2006
Posts: 13
|
' I added Option Strict Off becouse i need late binding. (this is my first error)
Option Strict Off ' I declared the necessary API routines: Declare Function FindWindow Lib "user32" Alias _ "FindWindowA" (ByVal lpClassName As String, _ ByVal lpWindowName As Long) As Long Declare Function SendMessage Lib "user32" Alias _ "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _ ByVal wParam As Long, ByVal lParam As Long) As Long Sub GetClient() Dim MyClt As Object ' Variable to hold reference ' to UO. Dim UOWasNotRunning As Boolean ' Flag for final release. ' I test to see if there is a copy of UO already running. On Error Resume Next ' Defer error trapping. ' Getobject function called without the first argument returns a ' reference to an instance of UO. ' If UO is not running, an error occurs. MyClt = GetObject(, "Client.Application") If Err().Number <> 0 Then UOWasNotRunning = True Err().Clear() ' Clear Err object in case error occurred. ' Check for UO. If UO is running, ' enter it into the Running Object table. DetectClient() ' I set the object variable to reference the file I wanted to see. MyClt = GetObject("C:\Program Files\EA GAMES\Ultima Online Samurai Empire\Client.exe") ' Show UO through its Application property. Then ' show the actual window containing the file using the Windows ' collection of the MyClt object reference. MyClt.Application.Visible = True MyClt.Parent.Windows(1).Visible = True ' Spot for manipulations here. ' End Sub Sub DetectClient() ' Procedure dectects a running Client and registers it. Const WM_USER = 1024 Dim hWnd As Long ' If Client is running this API call returns its handle. hWnd = FindWindow("Client", 0) If hWnd = 0 Then ' 0 means Client not running. Exit Sub Else ' Client is running so use the SendMessage API ' function to enter it in the Running Object Table. SendMessage(hWnd, WM_USER + 18, 0, 0) End If End Sub End Sub Private Sub CmdSend_Click() Dim MyString, MyStr ' Dim to save internal Mem. MyString = TxtSend.Text ' I define the string to be sent. MyStr = Left(MyString, 1000) MyClt = MyStr ' The destanation to print to. MyClt.SetFocus ' Get focus so that the Enter Key can be sent. SendKeys "{ENTER}" End Sub Thanks Yet again for your time and ill post my project code as i go to help others |
|
|
|
|
|
#5 (permalink) | |
|
Newbie
Join Date: Feb 2006
Posts: 13
|
Quote:
If Someone.Text = "I have VB6 installed and/or know the code" Then Someone.Value = <1% MsgBox ("Thanks for any help that you could give") Else If Someone.Text = "Iv had a bad day and im going to take it out on you" Then Someone.Value = >99% MsgBox ("Sorry your having a bad day, But i post here to get/give help") End if End argument ' If you dont have VB6 installed to compile this and/or dont know the code then please dont reply ' But if you have a Coding problem ask away. Thats why some of us are here |
|
|
|
|
|
|
#6 (permalink) | |
|
Newbie
Join Date: Feb 2006
Posts: 13
|
Quote:
I'm new to the RunUO forms but I'm sure you get people that try to get you to do all the work and not learn nothing from it but I'm not one of them. If the proper code was pasted id use it as reference only. Learning how to do it is more important to me than this little Prog. Last edited by JimJava; 02-19-2006 at 11:02 PM. |
|
|
|
|
|
|
#8 (permalink) | |
|
Newbie
Join Date: Feb 2006
Posts: 13
|
Quote:
Last edited by JimJava; 02-19-2006 at 11:31 PM. |
|
|
|
|
|
|
#9 (permalink) | |
|
Newbie
Join Date: Feb 2006
Posts: 13
|
Quote:
DLLViewer isnt working out so well. |
|
|
|
|
|
|
#10 (permalink) |
|
Newbie
Join Date: Feb 2006
Posts: 13
|
Im thinking i might be able to get around doing that. It would help me more to learn how its done with any App rather than UO its self.
Iv got a handle on the client (00200390) and all the keyboard function by using Spy++ that comes with VS6 (WM_KEYDOWN nVirtKey:VK_Then the Key sent) followed by Key up (WM_KEYUP nVirtKey:VK_Then the Key sent) Now im just trying to Code vb to send text to (00200390) by using the (WM_KEYFUNCTION) |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|