Go Back   RunUO - Ultima Online Emulation > Developer's Corner > Programming > Visual Basic

Visual Basic Visual Basic Discussion

Reply
 
Thread Tools Display Modes
Old 02-14-2006, 04:54 AM   #1 (permalink)
Newbie
 
JimJava's Avatar
 
Join Date: Feb 2006
Posts: 13
Default VB6 Sending and Receiving issues

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
JimJava is offline   Reply With Quote
Old 02-14-2006, 10:03 AM   #2 (permalink)
Forum Expert
 
TheOutkastDev's Avatar
 
Join Date: Sep 2002
Location: Houston, Texas
Age: 21
Posts: 3,933
Default

Try getting the handle to the UO window and using windows messages, the WM_ constants.
TheOutkastDev is offline   Reply With Quote
Old 02-18-2006, 11:41 PM   #3 (permalink)
Newbie
 
JimJava's Avatar
 
Join Date: Feb 2006
Posts: 13
Default Thanks but im still in a jam :( Heres what iv got so far on the Sending part

' 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
JimJava is offline   Reply With Quote
Old 02-18-2006, 11:47 PM   #4 (permalink)
Newbie
 
JimJava's Avatar
 
Join Date: Feb 2006
Posts: 13
Default You know

It sure would be nice if someone Copied this, Debuged it, and repasted it
JimJava is offline   Reply With Quote
Old 02-19-2006, 09:58 PM   #5 (permalink)
Newbie
 
JimJava's Avatar
 
Join Date: Feb 2006
Posts: 13
Default Yes Basically

Quote:
Originally Posted by Seanchen.net
What?

You want us to debug it for you, give me a break, do it yourself.

Not everyone has Visual Studio 6 still considering 99% of the programmers here wouldn't even have it instaled.
Let me reword that since iv seemed to push a button.

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
JimJava is offline   Reply With Quote
Old 02-19-2006, 10:35 PM   #6 (permalink)
Newbie
 
JimJava's Avatar
 
Join Date: Feb 2006
Posts: 13
Default

Quote:
Originally Posted by Seanchen.net
plus it doesn't even look like a complete class.
This is what i was shotting for. What everyone else sees wrong with it and posting it. I'm trying to learn/create this by the Info I'm given and already know. My goal isn't for everyone to code for me. I'm just requesting help when i get stuck and dont understand how to fix it. And maybe i will be able to pass this info along.
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.
JimJava is offline   Reply With Quote
Old 02-19-2006, 10:46 PM   #7 (permalink)
Newbie
 
JimJava's Avatar
 
Join Date: Feb 2006
Posts: 13
Default ouch

Look at all my typeO's Lol. I better learn to type before I try Coding
JimJava is offline   Reply With Quote
Old 02-19-2006, 11:08 PM   #8 (permalink)
Newbie
 
JimJava's Avatar
 
Join Date: Feb 2006
Posts: 13
Default Thanks for the reply

Quote:
Originally Posted by TheOutkastDev
Try getting the handle to the UO window and using windows messages, the WM_ constants.
Iv tryed doing this in the code posted but getting App handles is very new to me. Is this what you was suggesting ?

Last edited by JimJava; 02-19-2006 at 11:31 PM.
JimJava is offline   Reply With Quote
Old 02-19-2006, 11:12 PM   #9 (permalink)
Newbie
 
JimJava's Avatar
 
Join Date: Feb 2006
Posts: 13
Default

Quote:
Originally Posted by Seanchen.net
Ultima.dll shows a great deal of how to do this.

If you happen to figure it out, be sure to post what you find.
How could i open Ultima.DLL file in a readable format ?
DLLViewer isnt working out so well.
JimJava is offline   Reply With Quote
Old 02-20-2006, 12:13 PM   #10 (permalink)
Newbie
 
JimJava's Avatar
 
Join Date: Feb 2006
Posts: 13
Default

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)
JimJava is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5