0%

WndProdcHelper

you can define a wndproc for your winui 3 app.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
WndProcHelper wndProc;
wndProc = new WndProcHelper(Window window);

// for MainWindow use RegisterWndProc

wndProc.RegisterWndProc(WindowWndProc);

// and for InputNonClientPointerSource

wndProc.RegisterInputNonClientPointerSourceWndProc(InputNonClientPointerSourceWndProc);

private IntPtr WindowWndProc(IntPtr hWnd, NativeValues.WindowMessage Msg, IntPtr wParam, IntPtr lParam)
{
return wndProc.CallWindowProc(hWnd, Msg, wParam, lParam);
}

private IntPtr InputNonClientPointerSourceWndProc(IntPtr hWnd, NativeValues.WindowMessage Msg, IntPtr wParam, IntPtr lParam)
{
return wndProc.CallInputNonClientPointerSourceWindowProc(hWnd, Msg, wParam, lParam);
}

Demo

you can run demo and see this feature.