inputs.wVk &= 0xFF;
public boolean post (Event event) {	if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);	if (event == null) error (SWT.ERROR_NULL_ARGUMENT);	int type = event.type;	switch (type){		case SWT.KeyDown:		case SWT.KeyUp: {			KEYBDINPUT inputs = new KEYBDINPUT ();			inputs.wVk = (short) untranslateKey (event.keyCode);			if (inputs.wVk == 0) {				char key = event.character;				switch (key) {					case SWT.BS: inputs.wVk = (short) OS.VK_BACK; break;					case SWT.CR: inputs.wVk = (short) OS.VK_RETURN; break;					case SWT.DEL: inputs.wVk = (short) OS.VK_DELETE; break;					case SWT.ESC: inputs.wVk = (short) OS.VK_ESCAPE; break;					case SWT.TAB: inputs.wVk = (short) OS.VK_TAB; break;					/*					* Since there is no LF key on the keyboard, do not attempt					* to map LF to CR or attempt to post an LF key.					*///					case SWT.LF: inputs.wVk = (short) OS.VK_RETURN; break;					case SWT.LF: return false;					default: {						if (OS.IsWinCE) {							inputs.wVk = OS.CharUpper ((short) key);						} else {							inputs.wVk = OS.VkKeyScan ((short) wcsToMbcs (key, 0));							if (inputs.wVk == -1) return false;						}					}				}			}			inputs.dwFlags = type == SWT.KeyUp ? OS.KEYEVENTF_KEYUP : 0;			int hHeap = OS.GetProcessHeap ();			int pInputs = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, INPUT.sizeof);			OS.MoveMemory(pInputs, new int[] {OS.INPUT_KEYBOARD}, 4);			OS.MoveMemory (pInputs + 4, inputs, KEYBDINPUT.sizeof);			boolean result = OS.SendInput (1, pInputs, INPUT.sizeof) != 0;			OS.HeapFree (hHeap, 0, pInputs);			return result;		}		case SWT.MouseDown:		case SWT.MouseMove: 		case SWT.MouseUp: {			MOUSEINPUT inputs = new MOUSEINPUT ();			if (type == SWT.MouseMove){				inputs.dwFlags = OS.MOUSEEVENTF_MOVE | OS.MOUSEEVENTF_ABSOLUTE;				inputs.dx = event.x * 65535 / (OS.GetSystemMetrics (OS.SM_CXSCREEN) - 1);				inputs.dy = event.y * 65535 / (OS.GetSystemMetrics (OS.SM_CYSCREEN) - 1);			} else {				switch (event.button) {					case 1: inputs.dwFlags = type == SWT.MouseDown ? OS.MOUSEEVENTF_LEFTDOWN : OS.MOUSEEVENTF_LEFTUP; break;					case 2: inputs.dwFlags = type == SWT.MouseDown ? OS.MOUSEEVENTF_MIDDLEDOWN : OS.MOUSEEVENTF_MIDDLEUP; break;					case 3: inputs.dwFlags = type == SWT.MouseDown ? OS.MOUSEEVENTF_RIGHTDOWN : OS.MOUSEEVENTF_RIGHTUP; break;					default: return false;				}			}			int hHeap = OS.GetProcessHeap ();			int pInputs = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, INPUT.sizeof);			OS.MoveMemory(pInputs, new int[] {OS.INPUT_MOUSE}, 4);			OS.MoveMemory (pInputs + 4, inputs, MOUSEINPUT.sizeof);			boolean result = OS.SendInput (1, pInputs, INPUT.sizeof) != 0;			OS.HeapFree (hHeap, 0, pInputs);			return result;		}	} 	return false;}