• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

error simconnect_open

Messages
2
hello,

I'm trying to open a conection with simconnect and when I use the instruction "simconnect_open", the system display an error called: "Declare DLL call caused an exception". Anybody knows what's happening?

firstly I defined the api function like:

Declare SimConnect_Open IN SimConnect.dll long phSimConnect , string szName , long hWnd , long UserEventWin32 , long hEventHandle , long ConfigIndex

and then I call the funtion with the next instruction:

hr = SimConnect_Open(hSimConnect, "MYAPP", 0, 0, 0, 0)

I'm programming in Visual FoxPro.

Can anybody help me?

Thank's
 
Now that is an interesting twist! Visual FoxPro - I haven't done that in years, but I still have a pair of mugs from Fox software before MS bought the company. I'm needless to say a bit rusty on the VFP language, and I'll give it a shot anyway :)

You may have a couple of problems:

The declaration of SimConnect_Open is this in C/C++:
HRESULT SimConnect_Open(
HANDLE* phSimConnect,
LPCSTR szName,
HWND hWnd,
DWORD UserEventWin32,
HANDLE hEventHandle,
DWORD ConfigIndex
);

Your declare statement should look more like this:

DECLARE INTEGER SimConnect_Open IN simconnect.dll INTEGER @ phSimConnect, STRING app, INTEGER handle, INTEGER eventID, INTEGER evenHandle, INTEGER index

The first parameter must be passed by reference to get the value back.

If you still get an error, make sure that VFP can find the DLL in the proper path.

Lastly, VFP is probably unicode these days, simconnect isn't - make sure the srings you send to the SimConnect API are single byte strings.

Hope this helps,

Etienne
 
Last edited:
Back
Top