Jump to content
The simFlight Network Forums

Loading a flight from FSUIPC


Recommended Posts

Bonjour Pete,

I have problem when using the SDK to load a specific flight, and just after loading FS9.exe crash to desktop saying "A fatal error occurred."

Here is my code:

This is the MOUSE_CHILD_FUNCT

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

BOOL FSAPI Testfunc2( PPIXPOINT relative_point, FLAGS32 mouse_flags)

{

unsigned short zero = 0;

DWORD dwResult;

char chMsg[128];

zero = 0;

wsprintf(chMsg, "%s","C:\\Documents and Settings\\TRONCY\\My Documents\\Flight Simulator Files\\temp4.flt");

FSUIPC_Write(0x3F04, min(strlen(chMsg)+1, 127), &chMsg[0], &dwResult);

FSUIPC_Write(0x3F00, 2, &zero, &dwResult);

FSUIPC_Process(&dwResult);

return FALSE;

}

In the gaugecallbackfunction

void FSAPI gaugecallbackfunction( PGAUGEHDR pgauge, int service_id,

UINT32 extra_data )

{

;

DWORD dwResult;

switch(service_id)

{

case PANEL_SERVICE_PANEL_OPEN:

FSUIPC_Open2(SIM_ANY,&dwResult,Buffer_IPC,sizeof(Buffer_IPC));

break;

case PANEL_SERVICE_PANEL_CLOSE:

FSUIPC_Close();

break;

}

return;

Have you any idea of what i am doing wrong.

Thanks in advance.

Link to comment
Share on other sites

I have problem when using the SDK to load a specific flight, and just after loading FS9.exe crash to desktop saying "A fatal error occurred."

...

Have you any idea of what i am doing wrong.

Yes, exactly.

When you load a Flight it also unloads the current aircraft panel (including all the Gauges) and loads the aircraft and panel specified in the flight file.

You are trying to load a flight from a gauge which will, by the time the flight is loaded, simply not be there -- FS returns to the place where your gauge used to bebang, crash!

Regards,

Pete

Link to comment
Share on other sites

Bonsoir,

Thank you for your quick answer, I understand what's going on, though I noticed that sometimes it worked, may be the gauge was loaded exactly at the same address .

So I do not understand what is the use of this function as in any case the gauge is unloaded and FS will return to it, and of course crash.

Does it mean that i can only use it from a module.

Best regards

Claude

Link to comment
Share on other sites

So I do not understand what is the use of this function as in any case the gauge is unloaded and FS will return to it, and of course crash.

Does it mean that i can only use it from a module.

No, 99% of the use of FSUIPC facilities is from external programs -- EXEs on the same PC, or via WideFS. It would work from a DLL though, as they won't unload when you load a flight.

Regards,

Pete

Link to comment
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
×
×
  • 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.