Jump to content
The simFlight Network Forums

FSUIPC.net dll use with Module


Recommended Posts

Hello

At first, thank you for FSUIPC and the .net dll :)

I use Vb.net

I try to creat Functions in a Modul File to outsource the code.

this is my first function:


Public Sub connect()
Try
FSUIPCConnection.Open()
Catch ex As Exception
MsgBox("ERROR FSUIPC")
End Try
End Sub
[/CODE]

This function work very well.

But the next to read out the speed:

[CODE]
Public Sub mess()
Try
FSUIPCConnection.Process("")
Dim airSpeedKnots As Double = (airSpeed.Value / 128D)
' Label1.Text = airpeedKnots.ToString("f0")
trspeed = airSpeed.ToString("f0")
Catch ex As Exception
MsgBox("ERROR")
End Try
End Sub
[/CODE]

doesen´t work

i call the Function in form1 with [b]test.mess[/b]but i get only the try-catch Error (msgbox"ERROR")

i imports [b]Imports FSUIPC [/b]in both files (The Modul-File and Form1)

Anyone can help me?

Link to comment
Share on other sites

Public Sub mess()
		Try
			FSUIPCConnection.Process("")
			Dim airSpeedKnots As Double = (airSpeed.Value / 128D)
			' Label1.Text = airpeedKnots.ToString("f0")
			trspeed = airSpeed.ToString("f0")
		Catch ex As Exception
			MsgBox("ERROR")
		End Try
	End Sub
[/CODE]

doesen´t work
i call the Function in form1 with [b]test.mess[/b]but i get only the try-catch Error (msgbox"ERROR")
Anyone can help me?

Hi Alex,
It will help more if you know what the exception (error) is that is being thrown.  MsgBox("Error") isn't very helpful.  Something like this would be better:
[code]
MsgBox("Error: " & ex.Message)

Anyway I think I see the problem:

			FSUIPCConnection.Process("")

If you don't want to process a particular group just use:

FSUIPCConnection.Process()

The error you are getting probably says that the group "" does not exist.

If that's not it then show me the message from the exception that's being thrown.

Paul

Link to comment
Share on other sites

How can i read out the Gear Settings

is this possible?

Of course. The positions of the landing gear are at offsets 0BEC, 0BF0 and 0BF4.

Information about these offsets and all other offsets are found in the documentation from the FSUIPC SDK. Either "FSUIPC4 Offsets Status.pdf" for FSX or "FSUIPC for Programmers.pdf" for FS9 and earlier.

Paul

Link to comment
Share on other sites

Public Gear As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&0BF0) ' gear

The hex specifier in VB is &H. So you need this:

Public Gear As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&HBF0) ' gear

Please take some time to review the UserGuide that comes with my DLL and the VB sample application. Everything is explained and shown in great detail.

Paul

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.