コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }