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

FS2004 Access violation in execute_calculator_code()

Messages
8
Country
brazil
Hi.

I'm having a problem when I access the variable: "Rotor brake active" after starting the flight simulator with the R22 the problem does not occur, is there any way to check if this variable is created in memory to be able to read?

SINT32 varInt;
execute_calculator_code("(A:Rotor brake active, bool)",NULL,&varInt,NULL);

First-chance exception at 0x20e32b02 in fs9.exe: 0xC0000005: Access violation reading location 0x0000005c.

When I debug the programming line up on the execute_calculator_code the problem happens, but after selecting the R22 the problem does not happen.

I did a routine to do the checking, but is there a better place for this?

//----------------------------------------------------------------------

bool CheckVarOK(PCSTRINGZ name)
{
bool lRet = false;

__try
{
execute_calculator_code(name , NULL, NULL, NULL );
lRet = true;
}
__except ( EXCEPTION_EXECUTE_HANDLER )
{
}

return lRet;
}

//----------------------------------------------------------------------

Help me, what should I do?
 
When in the gauge cycle are you attempting to read the A:var?

The "safest place" is:

case PANEL_SERVICE_PRE_UPDATE:

If you need the data returned earlier:

case PANEL_SERVICE_PRE_DRAW:

or even:

case PANEL_SERVICE_PRE_INITIALIZE:
 
Hi n4gix okay?

Thanks for the help.
My intention is to make a dll for MSFS as a network server, the DLL is a multithreaded socket that will receive requests from customers for example:

Sends client => "(A: General eng1 generator active, bool)"
Server receives the client request.
and transmits the value to the customer => 1 for example.

I realized I do this directly inside the instance of the client connection error causes the server to access memory.

So did the following:

The server receives a message forwards it to the WndProc

LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
.....
}

the WndProc receives and sends the result to the server and the server sends to the client.

Everything that works normally if I'm playing with MSFS.

But when I leave the game and go back to the aircraft selection screen and then I boot the game again, execute_calculator_code function is blocked.

From what I understand the example that you told me is about creating tools. gau for MSFS.

In this case, my DLL is a socket for direct communication with customers

Any ideas friend?

Thanks for your support.
 
I tried the execute_calculator_code function in a C gauge and it caused the same access violation. I also tried reading the variable in an XML gauge, assigning it to an L:Variable and then reading the L:Variable. Same problem.
I really think your try/catch approach is the best one.

Doug
 
That specific variable seems to be somewhat flakey.

You are outside of my comfort zone here, because I've never even tried anything other than gauges.
 
Back
Top