Hi, sorry for the late reply... I'm new here
You do not need a Window handle to use SimConnect. This is a very common misconception, and many console-based SimConnect clients I've seen create fake windows and other trickery to get around it, including lots of `sleep()`ing and other workarounds.
Meanwhile,
SimConnect_Open() (in C[++]) or the SimConnect constructor (in C#,
shown here but not really documented) can optionally take what is known as a "wait handle" instead of (or in addition to, I suppose) a Window handle.
I'm not going to delve into explanations of wait handles in general, but in short you can use one to "wait for" a "signal" from SimConnect that a new message is available. You then call the SimConnect message dispatch processor which in turn, essentially, returns any message(s) waiting to be processed (the exact mechanism depends on the language used). Typically this waiting would be in a new thread, but not necessarily (depending on your needs). This takes the place of using the window event processor (and is arguably better anyway since your message dispatch doesn't have to run in the main/UI thread).
For C++/WinAPI this is maybe a good reference to start with:
Using Event Objects (Synchronization)
For C#/.NET this would be the equivalent:
EventWaitHandle
I don't have any simple examples to point you to... but I do have a couple:
For C++ you could look at
this class and search for
hSimEventHandle
(there are only a few instances where it is used.... it is declared in the header file as a
HANDLE
type).
Or another example, in a more complex code base can be seen in my
WASimClient, search for
hSimEvent
.
For C# you can look at my
SimConnectService
class and search the code for
EventWaitHandle _scReady
then see where
_scReady
is used (this part is actually pretty simple, there's just lots of other code there which can be ignored). Currently defined at this line (but may change):
SimConnectService.cs#L116
If you have any questions, let me know.
As a possible alternative to using SimConnect (at least directly) and for access to L vars and lots of other possibilities, you may want to investigate my
WASimCommander project which is a WASM module "server" and ready-to-use client implementations for C++ and .NET (including an example for Python).
If you like Python there's also a nice library named
Python-SimConnect which abstracts some of the gory details (I've not used it myself except to try it out). There are some similar "abstraction layers" for C# and probably other languages.
HTH,
-Max