Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Simconnect - periodically read data?

Featured Replies

Hi,can I use simconnect to periodically read data from FSX? Need a function, which i'll call in a while-loop. It must return the elevator position. Need to export this function into a DLL.Anyone can help?thx a lot

  • Commercial Member

>can I use simconnect to periodically read data from FSX? Need>a function, which i'll call in a while-loop. It must return>the elevator position. Need to export this function into a>DLL.SimConnect doesn't work that way. It sends you values but not on return of a request. It is asynchronous. You can ask it to send you values when they change, or at intervals. The intervals are from a fixed set, once of: SIMCONNECT_PERIOD_VISUAL_FRAME, SIMCONNECT_PERIOD_SIM_FRAME, SIMCONNECT_PERIOD_SECOND,If you wanted to impose your own polling period on that you'd have to program a routine to receive and store the values at one of the above periods (and you might as well set the "when changed" flag too, else it's wasteful). Then, in your while-loop (uh? which hopefully has a Sleep or something in it to avoid wastefully hogging the processor), just retrieve the last stored value.Really, you shouldn't use a while loop at all even for regular polling, but a timer event or callback. You could use SimConnect for that too if one of its periods were suitable. It has system events for every Frame, 6 times per second, every 1 second and every 4 seconds. Otherwise you'd use the Windows SetTimer facilities.RegardsPete

Win10: 22H2 19045.2728
CPU: 9900KS at 5.5GHz
Memory: 32Gb at 3800 MHz.
GPU:  RTX 24Gb Titan
2 x 2160p projectors at 25Hz onto 200 FOV curved screen

Hi !i have the same problem polling informations from FSX, regarding gear position.I did a loop calling the function onrecvsimobjectdata or something like that...but there are no result at all...i can get the information clicking regularly a button calling the function and displaying the information, but not in a while loop...why it doesn't work ?are there any examples or tutorial in VB.net to understand how it really works ?thank's for your helpFred

  • Commercial Member

>I did a loop calling the function onrecvsimobjectdata or>something like that...>but there are no result at all...>i can get the information clicking regularly a button calling>the function and displaying the information, but not in a>while loop...>why it doesn't work ?I've no idea what you are doing in your 2while" loop, but two things occur to me:1. If you are not releasing control to other processes in your loop, how do you expect other things to happen?2. The data from SimConnect is supplied asynchronously, via a CallBack -- not as a return to some call from you. So how are you expecting it to arrive in your "while loop"?Pete

Win10: 22H2 19045.2728
CPU: 9900KS at 5.5GHz
Memory: 32Gb at 3800 MHz.
GPU:  RTX 24Gb Titan
2 x 2160p projectors at 25Hz onto 200 FOV curved screen

Thank you for your answer Pete...i'm sure i haven't understand the philosophy of VB.net programming and simconnect workings...well, in a do...while loop i call the simconnect function as i can do thru a button...but even after the button click i have the result in a textfield of my form because the event is fired in simconnect (for example, the gear position which varie from 0 to 1 when the gear toggle is fired), i have not the same result in my loop....it seems that i have the result only when the control which have the loop ends...it's very amazing for me and very new to program in VB.net and also with events...Where can i find good tutorials to understand how simconnect works ?i've read the tutorials from NotASenator at http://www.notasenator.com/blog/ and i'm waiting for the following lessons...

hi again !i'm happy today because i succeeded to make my program work !how ? well, keeping on reading, thinking and trying things, i understood i was doing wrong. Event programming is not as difficult as i thought, but as different as i used to practice. So i left the loop programming away and used the event OnRecvSimobjectData with parameters SIMCONNECT_PERIOD.SIM_FRAME for the period and SIMCONNECT_DATA_REQUEST_FLAG.CHANGED for the data request flag. Then i included the things i wanted to do when this event received the massage.In fact it's a new way of thinking but easy to understand and use when you've found itThank's for your help

  • 6 years later...

Hi, apologies if this is the wrong forum to ask this. I trying to build a Cessna radio stack. I would like to use vb and simconnect to get the data from fsx. However I'm struggling; is there some example code that I could use to get started?

 

Many thanks

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.