Jump to content
The simFlight Network Forums
hkhoanguyen

How to check if P3D is running

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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


×