Thanks Steeler,
Apologies if I was covering old ground, I confess I hadn’t read the full thread.
With regards to the Windows Events being inefficient when frequent events are to be handled, I would have to slightly disagree.
I’m in the process of developing a client/server scenario for remote desktops, which requires many variable requests to be handled (each displayed instrument uses at least 1, usually several, SimVars), which are requested once but have many values being supplied by SimConnect.
It all depends on how you handle the WndProc events being raised.
If you are processing each raised event within the same thread or handling each request from start to end, then yes, it is inefficient and costly.
If you’re filtering the events and initiate the handler within its own thread, by invocation, then it’s very lightweight.
When debugging my code, I am monitoring the entire client/server environment, with many instruments being displayed and updated. The server component is by far the least costly in terms of resources and works extremely well.
You would only ever need to handle each event within the WndProc method if it was absolutely time-critical, but given the overall speed of how things respond in an aircraft, I cannot think of a single scenario where you must know of (and respond to) something the exact microsecond it happens - I’m happy for you to disagree.
I intend to publish the Client/Server code soon for anyone to use, once I complete the code changes needed for handling remote images (e.g. a GPS instrument). So my offer to share a snippet of code above is a little premature but was always planned.
The other benefit of using the Client/Server scenario is that it removes the obfuscation and complexities of the annoying nuances when dealing with SimConnect directly.
The code I’m developing also allows access for remote applications by exposing an API to request SimVar values and can co-exist and interact with applications developed in virtually any language, accessible from almost any PC on your network.
It also has many other features built-in, such as auto-notification when FS is running or stopped, caching the latest values for each variable requested, remembering which client has requested which variables, the last time each value was updated, the last time each client was updated, auto-resubmission of previous requests when FS restarts and many more.
I’m hopeful the code will, in some form, be helpful to any future developers wanting to use SimConnect, and perhaps provide a simpler interface for those wishing to avoid dealing with SimConnect entirely.
Dragonlaird