Jump to content
The simFlight Network Forums

FSUIPC and VB


Recommended Posts

Hi There guys,

I have been playing around with this FSUIPC module for a few days now and i just cant figure this out.

Im trying to get my VB program to read and check FS if im slewing or not.

I currecntly have this code..

Private Sub Command1_Click()
Dim dwResult As Long
Dim Slew As Integer

If FSUIPC_Read(&H5DC, 2, VarPtr(Slew), dwResult) Then
    If FSUIPC_Process(dwResult) Then
        If dwResult = 1 Then
            MsgBox "Slewing
        Else
            MsgBox "Not slewing
        End If
    End If
Else
    MsgBox "Cant read FSUIPC"
End If
End Sub

I just keep getting the error "Cant read FSUIPC".

Also the example in the SDK doesnt work either.

Please can someone help me.

Thanks in Advance..

Dave

Link to comment
Share on other sites

Hi There guys,

I have been playing around with this FSUIPC module for a few days now and i just cant figure this out.

Im trying to get my VB program to read and check FS if im slewing or not.

I currecntly have this code..

Private Sub Command1_Click()
Dim dwResult As Long
Dim Slew As Integer

If FSUIPC_Read(&H5DC, 2, VarPtr(Slew), dwResult) Then
    If FSUIPC_Process(dwResult) Then
        If dwResult = 1 Then
            MsgBox "Slewing
        Else
            MsgBox "Not slewing
        End If
    End If
Else
    MsgBox "Cant read FSUIPC"
End If
End Sub

I just keep getting the error "Cant read FSUIPC".

Also the example in the SDK doesnt work either.

Please can someone help me.

Thanks in Advance..

Dave

definately fsuipc_open, also

test for slew = 1 not dwresult = 1

Link to comment
Share on other sites

I think im having a problem with my actual FSUIPC. I have corrected myself as it says in the manual and its still getting nothing.

To prove this, i checked the error number with the numbers in the bas file and i got error number 7 which means incorrect version of FSUIPC but why am i getting this if i have the latest version (3.5.0)?

Dave

Link to comment
Share on other sites

Private Sub Command1_Click()
Dim dwResult As Long
Dim Slew As Integer

Call FSUIPC_Open(SIM_ANY, dwResult)
If FSUIPC_Read(&H5DC, 2, VarPtr(Slew), dwResult) Then
    If FSUIPC_Process(dwResult) Then
        If Slew = 1 Then
            MsgBox "Slewing!"
        Else
            MsgBox "Not Slewing"
        End If
    Else
        MsgBox "Cant Process. Error code: " & dwResult
    End If
Else
    MsgBox "Cant read. Error code: " & dwResult
End If
End Sub

I just dont understand what the problem is. I am always getting the "Incorrect version of FSUIPC" error.

If your wondering if i have the FSUIPC module included in the project, i have.

I have tried multiple versions of FSUIPC and still having no luck with it.

Link to comment
Share on other sites

i'm assuming SIM_ANY is defined?

i'm assuming fs is running when you try this button click?

suggest you breakpoint at every fsuipc call, and make sure all your variables contain the right values, and find which call causes the error message

jd

Link to comment
Share on other sites

Private Sub Command1_Click()
Dim dwResult As Long
Dim Slew As Integer

Call FSUIPC_Open(SIM_ANY, dwResult)
If FSUIPC_Read(&H5DC, 2, VarPtr(Slew), dwResult) ...

I just dont understand what the problem is. I am always getting the "Incorrect version of FSUIPC" error.

Two questions.

First, you are not checking the result of the Open. It is only on the Open call that an FSUIPC_ERR_VERSION error can be returned -- unless someone has messed up the VB version of my code compared to the C version I wrote. There is nowhere in the FSUIPC_Read code nor the FSUIPC_Process code that sets this error.

Second, how is it that you need "VarPtr" for one variable value being returned, but not for the other (dwResult)? In C terms there's no difference in these, both a pointers to memory and both get written to by the code.

Incidentally, you also fail to mention wether you are getting this error on the Read or on the Process. But you should check the result of the Open, not simply "Call" it.

Regards,

Pete

Link to comment
Share on other sites

The problem is is that it wont open, it keeps saying incorrect version (error 7).

I have just had a thought, does my .exe file have to be in the same folder as the FSUIPC.dll when i execute it?

And yeh, FS is running when i run the program.

SIM_ANY is defined in the FSUIPC.bas module.

Link to comment
Share on other sites

The problem is is that it wont open, it keeps saying incorrect version (error 7).

How can you tell if you aren't checking the error on the Open? According to the code snippets you show you never check the return or the result of the Open call!

I have just had a thought, does my .exe file have to be in the same folder as the FSUIPC.dll when i execute it?

NO!!! FSUIPC runs in FS, in the Modules folder. It is not used directly by your program at all.

And yeh, FS is running when i run the program.

Have you used FSUIPC Logging -- there are options to log all IPC calls, both reads and writes? It will also log the identity of any program connecting to it.

Additionally FSInterrogate is supplied in the FSUIPC SDK. Please use that to check the things you are trying to read.

All these tools are provided for a purpose -- to help you develop and debug your programs. I'm afraid I know nothing about VB and the VB parts are not my work (though derived from it) -- but you are in excellent hands with JD's help.

Regards,

Pete

Link to comment
Share on other sites

Hi Pete,

Im not saying that FSUIPC isnt working well it isnt working in a way if you know what i mean.

The example in the SDK doesnt work so that must show that there is a problem with my FSUIPC dont you agree?

I have changed my VB code around to find that i get error 7 i basically just did if(FSUIPC_open(........)) then have a msgbox.

Dave

Link to comment
Share on other sites

The example in the SDK doesnt work so that must show that there is a problem with my FSUIPC dont you agree?

Not necessarily. Really unless you show me the log and start using the tools provided to help you, I don't see how I can give any further advice at all. Please, to start with, simply look in the FS Modules folder, find the FSUIPC.LOG file, and see what it says. That's the first thing to do always. Second, assuming that part's okay, is to use the IPC logging and possibly verify your installation with FSInterrogate.

These tools are provided to HELP YOU and to save everyone a lot of time.

Regards,

Pete

Link to comment
Share on other sites

Hi Pete and jd,

Not even to the example in the SDK.

I am using FS Interrogate. I used it to get the code of Slew Mode.

It just doesnt connect to FSUIPC. Like i keep saying over and over, i get error 7 which means Incorrect Version.

SIM_ANY and SIM_FS2k4 both dont work so soemthing must be wrong somewhere.

Pete, in the log file i just found this..

73344 C:\Documents and Settings\David\Desktop\Project1.exe

73359 Product="FSPROG"

73359 Company="Home"

Does that mean it has opened the connection correctly?

Please can one of you send me a working copy of a VB program that accesses FSUIPC then that way i will know if it is working or not?

Thanks in advance, Dave

Link to comment
Share on other sites

Ok, i have an update for you, i reinstalled FSUIPC and now it is connecting because Flight Simulator goes mad saying that it is unregistered.

So basically i cant do what i was wanting to do unless i buy FSUIPC?

Oh well, i wont be able to do this now as im a full time student and i am always very low on funds.

Thank you for your help guys.

Link to comment
Share on other sites

Like i keep saying over and over, i get error 7 which means Incorrect Version.

Actually it says here "Incorrect version of FSUIPC, or not FSUIPC". Looking at the code it gives error 7 on Open (only!) if the version number is older than 1.998e or if the validity check word at offset 330A is not equal to hex "FADE".

Pete, in the log file i just found this..

73344 C:\Documents and Settings\David\Desktop\Project1.exe

73359 Product="FSPROG"

73359 Company="Home"

Does that mean it has opened the connection correctly?

It means that the Open has sent a message. There will be entries later in the log saying more, expecially if you enabled IPC read/write logging as I asked.

Please just run the program, then close down FS show show me the complete log, not just your chosen snippets.

Please can one of you send me a working copy of a VB program that accesses FSUIPC then that way I will know if it is working or not?

I have no VB program sources other that the one in the SDK, which works as far as I know (at least with a user registered FSUIPC -- but it certainly will not fail error 7 even without).

To check your installation of FSUIPC simply try FSInterrogate, or any of the free little programs I supply in the FSUIPC ZIP, such as TrafficLook and WeatherSet2.

Regards,

Pete

Link to comment
Share on other sites

Ahh the reason it wasnt working earlier was because my version must have been too old and when i downloaded and installed your new version it worked well sort of worked but i need to have a special accredited key which i had to request from pete.

Thanks for both your help.

As my friend always says to me RTFM (need i say what that means :P).

Thanks again

Dave

Link to comment
Share on other sites

Ahh the reason it wasnt working earlier was because my version must have been too old and when i downloaded and installed your new version it worked ...

But many messages ago you said:

To prove this, i checked the error number with the numbers in the bas file and i got error number 7 which means incorrect version of FSUIPC but why am i getting this if i have the latest version (3.5.0)?

Anyway, I don't understand at all. As I said, the only version which is "too old" as far as Error 7 is concerned is one which is older than 1.998e, which would date it to about 5 or 6 years ago I think!

Regards,

Pete

Link to comment
Share on other sites

Yeah i was a noob and thought i had the latest version so i went to your website and got the latest version number. I dont know what was wrong.

It must have been my incorrect coding in VB before.

I know when programming in PHP you get an error just by missing off a simple " or a ;.

Dave

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • 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.