IntPtr NewWindowProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam) { var args = new WindowsNativeMessageEventArgs(hWnd, msg, wParam, lParam); NativeMessage?.Invoke(this, args); return(CallWindowProc(oldWndProc, hWnd, msg, wParam, lParam)); }
protected virtual void OnNativeMessage(object?sender, WindowsNativeMessageEventArgs args) { if (args.MessageId == WindowsNativeMessageIds.WM_SETTINGCHANGE || args.MessageId == WindowsNativeMessageIds.WM_THEMECHANGE) { MauiWinUIApplication.Current.Application?.ThemeChanged(); } MauiWinUIApplication.Current.Services?.InvokeLifecycleEvents <WindowsLifecycle.OnNativeMessage>(m => m(this, args)); }