crwk78 Posted March 6, 2019 Report Posted March 6, 2019 Hi, My code below works when I boot P3D and FSUIPC is detected as having connected (the label changes from default red to green). When I close P3D, the label remains green when I am expecting it to turn red again. Any ideas why this happens?
Paul Henty Posted March 6, 2019 Report Posted March 6, 2019 Looks like you forgot to paste the code in. Paul
crwk78 Posted March 6, 2019 Author Report Posted March 6, 2019 I pasted it in then deleted it as I couldn't put the cursor above the quote to type my message, then forgot to paste it back! Sorry, here it is: Quote Private Sub fsuipcTimer_Tick(sender As Object, e As EventArgs) Handles fsuipcTimer.Tick Try FSUIPCConnection.Open() Catch End Try If FSUIPCConnection.IsOpen Then fsuipcStatus.BackColor = Color.DarkGreen Else fsuipcStatus.BackColor = Color.Red End If End Sub
Paul Henty Posted March 6, 2019 Report Posted March 6, 2019 The DLL thinks the connection is still open because you're not doing any process() calls. Because of the way FSUIPC works, the DLL can only know that P3D has been closed by trying to talk to it. During a process(), if the sim is not answering then the DLL knows the 'connection' is lost. Only then will the IsOpen flag be set to false. Unless you call Process() there is no attempted communication with P3D. If you need a good starting point for an application with the automatic connection handling already written, please check out the FSUIPC application templates available on the website... http://fsuipc.paulhenty.com/#downloads Even if you don't use them as templates, you can see the best way handle the connection and main program loop by looking at the code. Paul
crwk78 Posted March 7, 2019 Author Report Posted March 7, 2019 Thanks Paul, works fine now that I've added the Process () call.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now