Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

SimConnect from Windows Presentation Foundation (WPF)

Featured Replies

The SimConnect SDK examples for .NET are written for Windows Form Applications. The secret sauce for processing events is: protected override void DefWndProc(ref Message m) { if (m.Msg == WM_USER_SIMCONNECT) { if (simconnect != null) { simconnect.ReceiveMessage(); } } else { base.DefWndProc(ref m); } }This code overrides the default windows procedure to intercept WM_USER_SIMCONNECT messages.Does anyone know how to do this in WPF (aka Avalon) applications? There is no DefWndProc type override in a WPF window. After hours of research, I've come up empty.ThanksRich Lucas

  • Author

After a few days of experimenting, I am finally SimConnected from a WPF application. The secret sauce is:1. Use WindowInteropHelper class to get a handle to the app's main window. WindowInteropHelper wih = new WindowInteropHelper(this.MainWindow);2. Obtain the window handle (hwnd) from WindowInteropHelper. hwnd = wih.Handle;3. Create a HwndSource class from the handle. HwndSource hs = HwndSource.FromHwnd(hwnd);4. Use HwndSource.AddHook() to intercept Win32 messages. hs.AddHook(new HwndSourceHook(ProcessSimConnectWin32Events))5. Create a message handler.private IntPtr ProcessSimConnectWin32Events( IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled){ handled = false; if (msg == WM_SIMCONNECT_EVENT) { if (connected && simconnect != null) { simconnect.ReceiveMessage(); handled = true; } } return (IntPtr)0;}

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.