@Override
		public LRESULT callback( HWND hwnd, int uMsg, WPARAM wParam, LPARAM lParam ) {
			long wparam = wParam.longValue();
			switch( uMsg ) {
				case WM_NCCALCSIZE:
					return WmNcCalcSize( hwnd, uMsg, wParam, lParam );

				case WM_NCHITTEST:
					return WmNcHitTest( hwnd, uMsg, wParam, lParam );

				case WM_NCMOUSEMOVE:
					// if mouse is moved over some non-client areas,
					// send it also to the client area to allow Swing to process it
					// (required for Windows 11 maximize button)
					if( wparam == HTMINBUTTON || wparam == HTMAXBUTTON || wparam == HTCLOSE ||
						wparam == HTCAPTION || wparam == HTSYSMENU )
					  sendMessageToClientArea( hwnd, WM_MOUSEMOVE, lParam );
					break;

				case WM_NCLBUTTONDOWN:
				case WM_NCLBUTTONUP:
					// if left mouse was pressed/released over minimize/maximize/close button,
					// send it also to the client area to allow Swing to process it
					// (required for Windows 11 maximize button)
					if( wparam == HTMINBUTTON || wparam == HTMAXBUTTON || wparam == HTCLOSE ) {
						int uClientMsg = (uMsg == WM_NCLBUTTONDOWN) ? WM_LBUTTONDOWN : WM_LBUTTONUP;
						sendMessageToClientArea( hwnd, uClientMsg, lParam );
						return new LRESULT( 0 );
					}
					break;

				case WM_NCRBUTTONUP:
					if( wparam == HTCAPTION || wparam == HTSYSMENU )
						openSystemMenu( hwnd, GET_X_LPARAM( lParam ), GET_Y_LPARAM( lParam ) );
					break;

				case WM_DWMCOLORIZATIONCOLORCHANGED:
					fireStateChangedLaterOnce();
					break;

				case WM_SIZE:
					if( wmSizeWParam >= 0 )
						wParam = new WPARAM( wmSizeWParam );
					break;

				case WM_ENTERSIZEMOVE:
					isMovingOrSizing = true;
					break;

				case WM_EXITSIZEMOVE:
					isMovingOrSizing = isMoving = false;
					break;

				case WM_MOVE:
				case WM_MOVING:
					if( isMovingOrSizing )
						isMoving = true;
					break;

				case WM_DPICHANGED:
					LRESULT lResult = User32Ex.INSTANCE.CallWindowProc( defaultWndProc, hwnd, uMsg, wParam, lParam );

					// if window is maximized and DPI/scaling changed, then Windows
					// does not send a subsequent WM_SIZE message and Java window bounds,
					// which depend on scale factor, are not updated
					boolean isMaximized = User32Ex.INSTANCE.IsZoomed( hwnd );
					if( isMaximized ) {
						MyRECT r = new MyRECT( new Pointer( lParam.longValue() ) );
						int width = r.right - r.left;
						int height = r.bottom - r.top;
						User32Ex.INSTANCE.CallWindowProc( defaultWndProc, hwnd, WM_SIZE, new WPARAM( SIZE_MAXIMIZED ), MAKELPARAM( width, height ) );
					}

					return lResult;

				case WM_ERASEBKGND:
					// do not erase background while the user is moving the window,
					// otherwise there may be rendering artifacts on HiDPI screens with Java 9+
					// when dragging the window partly offscreen and back into the screen bounds
					if( isMoving )
						return new LRESULT( 0 );

					return WmEraseBkgnd( hwnd, uMsg, wParam, lParam );

				case WM_DESTROY:
					return WmDestroy( hwnd, uMsg, wParam, lParam );
			}

			return User32Ex.INSTANCE.CallWindowProc( defaultWndProc, hwnd, uMsg, wParam, lParam );
		}
NOTE: This method is invoked on the AWT-Windows thread (not the AWT-EventQueue thread).
flatlaf-natives/flatlaf-natives-jna/src/main/java/com/formdev/flatlaf/natives/jna/windows/FlatWindowsNativeWindowBorder.java