Problem with C# SimConnect constructor

minime
Posts: 1198
Joined: Mon Jun 10, 2013 4:33 pm

Postby minime » Tue Jul 23, 2013 8:12 am



I am trying to get a message queue going for SimConnect using:



Connection = new SimConnect("appname", IntPtr.Zero, WM_USER_SIMCONNECT, null, 0);



and then simply polling by doing:



while (1)

{

Connection.ReceiveMessage();

}



(I also had a version going with the Synchronization object, that worked great as well. As long, as I had a window handle.)



Now, as I moved my code into the real environment, it is not working anymore. It seems like it is not possible to not supply a window handle, although I do not understand what it needs a window handle for if I want to do the polling approach or synchronization object approach anyway. If I supply the zero IntPtr, it will crash. Its obviously not checking for a zero pointer.



The problem is, I can not give it a window handle, because I don't have one. I can't even create one, because simply said I don't have access to the messaging queue of the parent software, I am just writing a DLL. So I can never ever receive those SimConnect messages using that approach.



Is there a way around this? Some magic IntPtr that will not make it crash?



And why does it require a window handle at all if I don't want to receive windows messages?



P.S.: On a sidenote, please make the C# SimConnect client OpenSource, so that we can make all those SimConnect pains go away. ;)

Return to “Software Development Kit (SDK) Questions”

Who is online

Users browsing this forum: No registered users and 28 guests