P3D v4 Desperately trying to make SimConnect with C ++ work in managed code

rhumbaflappy

Moderator
Staff member
Resource contributor
#21
Thanks a lot,
I have tried it before, it compiles and works nicely but is linked with a FSW simconnect.lib and Dovetail Simconnect.dll on the executable folder.
Does not link with p3d simconnect.lib, however i'm not sure to have such extension, will give a try.
Most simple C++ programs convert easily to Managed C++ by just changing the compiler directives. Google IJW (it just works).
 
#22
Thanks a lot, i have routed these tracks:
1. using this:
https://blogs.msdn.microsoft.com/abhina ... ogramming/
tried to mix managed and unmanaged code using compiler directive as suggested also by you, it compiles but does not link with unmanaged LM SimConnect.Debug.lib or SimConnect.lib
2. as suggested installing C++/CLR Windows Form for Visual Studio 2017, same as above, your FSW_Slew works nicely since is linked with Dovetail SimConnect.lib which obviously does not work in P3D.

so i'm again stuck, but won't give up.
/Mario
 
#23
[SOLVED]
Thanks to Benjamin Erd i have now corrected my code and it works, so i have nice managed SimConnect C++ code.
2 fix to do to code:
Code:
Sim_Connect = gcnew SimConnect(safe_cast<String^>("tf104gconfig"),this->Handle, WM_USER_SIMCONNECT, nullptr, 0);
and
Code:
this->simConnect->OnRecvOpen += gcnew SimConnect::RecvOpenEventHandler(this, &MainForm::OnRecvOpen);
being OnRecvOpen a private method in Main Form:
Code:
void MyForm::OnRecvOpen(SimConnect ^sender, SIMCONNECT_RECV_OPEN ^data)    {    
MessageBox::Show("OnRecvOpen called");   
 }
available to send in pm the solution for Visual C++ 2017 Community.
Thanks to all, even to those who, instead of helping, have insulted me.
/mario
 
#25
Glad you got it fixed. Sorry we couldn't be more helpful.
Thanks,
i have set HERE the complete managed C++/SimConnect solution (Visual Studio C++ 2017 Community), it entraps both SIMCONNECT_OPEN and SIMCONNECT_QUIT into WinForms private methods, even simple guess is a good starting point to create nice UI that can crosstalk with the sim via SimConnect.
Credits due also to Benjamin Erd that pointed me in the right direction, a good example of connections with fellow developers and helping each other, guess is the right way rather than insults.
/Mario
 
Top