- Messages
- 7
- Country

Hi everyone,
In Visual Studio 2019 and C#.Net (WPF) I can establish a working connection to MSFS
(is setting up with an aircraft before takeoff).
Subscribed events like OnRecvOpen are fired correctly.
But the subscrition to the RequestDataOnSimObjectType will not fire.
My code snippets:
using Microsoft.FlightSimulator.SimConnect;
enum ENUM {A=0}
static SimConnect smcn; //Global
--------------------
void connect() {
HwndSource src;
src=HwndSource.FromHwnd (new WindowInteropHelper (this).Handle); //this is my WPF-WindowClasss
smcn=new SimConnect("Any", src.Handle, 0x0402, null, 0);
src.AddHook(new HwndSourceHook (WndProc));
smcn.OnRecvSimobjectDataBytype+=
new SimConnect.RecvSimobjectDataBytypeEventHandler (OnGetDataByte);
//And now Call it:
smcn.RequestDataOnSimObjectType (ENUM.A, ENUM.A, 0, SIMCONNECT_SIMOBJECT_TYPE.USER);
}
--------------------
static IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wpar, IntPtr lpar, ref bool handled) {
switch(msg) {
case 0x0402:
handled=true; smcn.ReceiveMessage(); break;
}return IntPtr.Zero;
}
--------------------
void OnGetDataByte(SimConnect sender, SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE data) {
IS NEVER BE FIRED !!!!!!!
}
Thanks for helping in advance
In Visual Studio 2019 and C#.Net (WPF) I can establish a working connection to MSFS
(is setting up with an aircraft before takeoff).
Subscribed events like OnRecvOpen are fired correctly.
But the subscrition to the RequestDataOnSimObjectType will not fire.
My code snippets:
using Microsoft.FlightSimulator.SimConnect;
enum ENUM {A=0}
static SimConnect smcn; //Global
--------------------
void connect() {
HwndSource src;
src=HwndSource.FromHwnd (new WindowInteropHelper (this).Handle); //this is my WPF-WindowClasss
smcn=new SimConnect("Any", src.Handle, 0x0402, null, 0);
src.AddHook(new HwndSourceHook (WndProc));
smcn.OnRecvSimobjectDataBytype+=
new SimConnect.RecvSimobjectDataBytypeEventHandler (OnGetDataByte);
//And now Call it:
smcn.RequestDataOnSimObjectType (ENUM.A, ENUM.A, 0, SIMCONNECT_SIMOBJECT_TYPE.USER);
}
--------------------
static IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wpar, IntPtr lpar, ref bool handled) {
switch(msg) {
case 0x0402:
handled=true; smcn.ReceiveMessage(); break;
}return IntPtr.Zero;
}
--------------------
void OnGetDataByte(SimConnect sender, SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE data) {
IS NEVER BE FIRED !!!!!!!
}
Thanks for helping in advance