case SWT_KEYMSG:
case SWT_KEYMSG: {
int messageProc (int hwnd, int msg, int wParam, int lParam) {	switch (msg) {		case SWT_KEYMSG:			boolean consumed = false;			MSG keyMsg = new MSG ();			OS.MoveMemory (keyMsg, lParam, MSG.sizeof);			Control control = findControl (keyMsg.hwnd);			if (control != null) {				keyMsg.hwnd = control.handle;				int flags = OS.PM_REMOVE | OS.PM_NOYIELD | OS.PM_QS_INPUT | OS.PM_QS_POSTMESSAGE;				do {					if (!(consumed |= filterMessage (keyMsg))) {						OS.TranslateMessage (keyMsg);						consumed |= OS.DispatchMessage (keyMsg) == 1;						}				} while (OS.PeekMessage (keyMsg, keyMsg.hwnd, OS.WM_KEYFIRST, OS.WM_KEYLAST, flags));			}			if (consumed) {				int hHeap = OS.GetProcessHeap ();				OS.HeapFree (hHeap, 0, lParam);			} else {				OS.PostMessage (embeddedHwnd, SWT_KEYMSG, wParam, lParam);			}			return 0;		case SWT_SETTINGCHANGED: {			settingsChanged = false;			Font oldFont = getSystemFont ();			updateImages ();			updateFonts ();			sendEvent (SWT.Settings, null);			Font newFont = getSystemFont ();			Shell [] shells = getShells ();			for (int i=0; i<shells.length; i++) {				Shell shell = shells [i];				if (!shell.isDisposed ()) {					shell.updateFont (oldFont, newFont);				}			}			break;		}		case SWT_TRAYICONMSG:			if (tray != null) {				TrayItem [] items = tray.items;				for (int i=0; i<items.length; i++) {					TrayItem item = items [i];					if (item != null && item.id == wParam) {						return item.messageProc (hwnd, msg, wParam, lParam);					}				}			}			return 0;		case OS.WM_ACTIVATEAPP:			/*			* Feature in Windows.  When multiple shells are			* disabled and one of the shells has an enabled			* dialog child and the user selects a disabled			* shell that does not have the enabled dialog			* child using the Task bar, Windows brings the			* disabled shell to the front.  As soon as the			* user clicks on the disabled shell, the enabled			* dialog child comes to the front.  This behavior			* is unspecified and seems strange.  Normally, a			* disabled shell is frozen on the screen and the			* user cannot change the z-order by clicking with			* the mouse.  The fix is to look for WM_ACTIVATEAPP			* and force the enabled dialog child to the front.			* This is typically what the user is expecting.			* 			* NOTE: If the modal shell is disabled for any			* reason, it should not be brought to the front.			*/			if (wParam != 0) {				if (!isXMouseActive ()) {					if (modalDialogShell != null && modalDialogShell.isDisposed ()) modalDialogShell = null;					Shell modal = modalDialogShell != null ? modalDialogShell : getModalShell ();					if (modal != null) {						int hwndModal = modal.handle;						if (OS.IsWindowEnabled (hwndModal)) {							modal.bringToTop ();							if (modal.isDisposed ()) break;						}						int hwndPopup = OS.GetLastActivePopup (hwndModal);						if (hwndPopup != 0 && hwndPopup != modal.handle) {							if (getControl (hwndPopup) == null) {								if (OS.IsWindowEnabled (hwndPopup)) {									OS.SetActiveWindow (hwndPopup);								}							}						}					}				}			}			break;		case OS.WM_ENDSESSION:			if (wParam != 0) {				dispose ();				/*				* When the session is ending, no SWT program can continue				* to run.  In order to avoid running code after the display				* has been disposed, exit from Java.				*/				System.exit (0);			}			break;		case OS.WM_QUERYENDSESSION:			Event event = new Event ();			sendEvent (SWT.Close, event);			if (!event.doit) return 0;			break;		case OS.WM_SETTINGCHANGE:			if (settingsChanged) break;			settingsChanged = true;			OS.PostMessage (hwnd, SWT_SETTINGCHANGED, 0 ,0);			break;		case OS.WM_TIMER:			runTimer (wParam);			break;		default:			if (msg == SWT_TASKBARCREATED) {				if (tray != null) {					TrayItem [] items = tray.items;					for (int i=0; i<items.length; i++) {						TrayItem item = items [i];						if (item != null) item.recreate ();					}				}			}	}	return OS.DefWindowProc (hwnd, msg, wParam, lParam);}