Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi,

I'm developing a small application with FSUIPC .NET, i dont know if it exists a way to check P3D is running or not? 

//Check P3D running Before starting Process()

FSUIPCConnection.Process(); // Process the request to FSUIPC
FSUIPCConnection.Process("AircraftInfo"); // For aicraft typ

Thanks

Posted

You can use

FSUIPCConnection.IsConnectionOpen()

e.g.:

            if (FSUIPCConnection.IsConnectionOpen())
            {
                FSUIPCConnection.Process(); // Process the request to FSUIPC
                FSUIPCConnection.Process("AircraftInfo"); // For aicraft type
            }

However, you'll need version 3 of the DLL for this. It's not in the 2.4 version.

I've attached it here. It requires .NET 4 or later, there is no build for earlier frameworks.

If you don't want to upgrade then you'll need to keep track of the connection yourself. In the 2.4 download there is a sample application in C# which tracks the connection status by catching exceptions.

Paul

FSUIPCClient3.0_RC5.zip

  • 2 months later...
Posted

Dear  hkhoanguyen

We use VB6. You may adopt to .NET our proposal.

You can use the Windows API FindWindow and search for class "FS98MAIN".
Take the hadle received to read with Windows API GetWindowText.

The P3D windows does change from "Lockheed Martin® Prepar3D® v3 with WideServer: waiting for clients" to
"Lockheed Martin® Prepar3D® v3 with WideServer: 1 connected" where 1 shows total clients connected.
when this is up, P3D and FSUIPC do run properly.

During flying check offset &H3F02, 2, VarPtr(FS_FLTSTN_RELOAD) against a variable xxx_OLD if it does increase.
If it does, wait until reloaded with offset &H3365, 1, VarPtr(FS_MENUDIALOG_FLAG). Wait until not anymore 1 but 0.
Reload all new data required into your application.

Hope this assists. Regards
Peter

  • 9 months later...
Posted

Hi, my answer will be with VB coding.

        Try
            OpenFSUIPC()
            FSUIPCConnection.Close()
        Catch ex As Exception
            FSUIPCConnection.Close()
            MsgBox("FSUIPC Not Found or FS is not running !")
            Exit Sub
        End Try

            ...

            ...

You may continue your code blocks but if OpenFSUIPC produces an error, the SUB will be stopped due to error handling with a messagebox and the code will not be run anymore.

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.