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

[?] Console application

Messages
4
Country
netherlands
Hi all,

I'm trying to write a C# console application to try and gain some SimConnect and C# skills. The application connects to FSX properly, but disconnects immediately. Does anyone know why?
 
If you just have a string of SimConnect commands in a row in your main(), that's not going to work as SimConnect is an Async API (you call something to request some info, at some later point that info comes back and an event is fired). If you have the async part right but you don't have something to keep the console app from immediately exiting (like a simple Console.ReadLine()) then the app will just exit.

If neither of those sounds like what you are seeing, then we may need a little more description of what you are doing (cut and paste some code in here, be sure and use the CODE feature in the editor) and exactly what happens when you run your app.
 
Well, I looked at a C++ exmple in the SDK and I found:

Code:
while(0 == quit) {
    SimConnect_CallDispatch(hSimConnect, MyDispatchProcSO, NULL);
    Sleep(1);
} 
hr = SimConnect_Close(hSimConnect);

So I added "while(0 == quit)" to my C# code, but the app does nothing; means to me that events aren't raised. Any ideas why that may be?
 
Hello Marcin,

Tbh, I started off at that link too; that's why I can now even connect to FSX, but I want to try a console application rather than having (yet another) GUI window on my desktop. That is because the SimConnect diagnostic console thingy merges all console applications into one, yet still allowing for some diagnostic output.
 
Back
Top