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

Handling Errors when SimConnect is not Present

scruffyduck

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
34,981
Country
unitedkingdom
I am finding that if Simconnect is not present or the wrong version there is no way to catch the error. A program like ADE should work even when FSX is not present although without the Simconnect functions. However I am finding that the crash occurs very early and I can't put any error trapping round it at the moment.

Using C#.

Thanks in advance for any pointers.
 
I tested in the setup package.

Using inno setup the script is something like this:

Code:
function InitializeSetup(): Boolean;
var
  ErrorCode: Integer;
  NetFrameWorkInstalled : Boolean;
  SimConnectInstalled : Boolean;
  Result1 : Boolean;
  sRet: string;
begin

  NetFrameWorkInstalled := RegKeyExists(HKLM,'SOFTWARE\Microsoft\.NETFramework\policy\v2.0');
  if NetFrameWorkInstalled =true then
  begin
    Result := true;
  end
  else
  begin
    Result1 := MsgBox('This setup requires the .NET 2.0 Framework. Please download and install the .NET Framework and run this setup again. Do you want to download the framework now?',
      mbConfirmation, MB_YESNO) = idYes;
    Result:=false;
    if Result1 =true then
    begin
      ShellExec('open', 'http://www.microsoft.com/downloads/details.aspx?familyid=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&displaylang=en','','',SW_SHOWNORMAL,ewNoWait,ErrorCode);
    end;
    exit;
  end;

  SimConnectInstalled := RegValueExists(HKCR,'Installer\Assemblies\Global','Microsoft.FlightSimulator.SimConnect,publicKeyToken="31BF3856AD364E35",version="10.0.61242.0",processorArchitecture="x86",culture="neutral"');
  if SimConnectInstalled =true then
  begin
    Result := true;
  end
  else
  begin
      MsgBox('This setup requires SP1 Simconnect . Please Install it',mbInformation, MB_OK);
      Result:=false;
  end;
 
Hi Jose

Thanks - I am not using an installer at the moment - I guess I need to :)
 
Hi Jon.

private void button_Connect_Click(object sender, EventArgs e)
{
if (my_simconnect == null)
{
try
{
my_simconnect = new Microsoft.FlightSimulator.SimConnect.SimConnect("Managed Data Request", base.Handle, 0x402, null, 0);
setButtons(false, true);
initDataRequest();
timer1.Enabled = true;
}
catch (COMException)
{
label_status.Text = "Unable to connect to FSX";
}
}
else
{
label_status.Text = "Error - try again";
closeConnection();
setButtons(true, false);
timer1.Enabled = false;
}
}

This gives TCalcX a way to handle the error.

Dick
 
Hi Dick

Thanks very much I will try something along those lines. Much appreciated.
 
Back
Top