Go Premium for a chance to win a PS4. Enter to Win

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 646
  • Last Modified:

Keyboard Events on WindowsCE 3.0


I'm developing an web based application to run on
Pocket Intener Explorer and i have a trouble.

I need to capture "keyboard events" in a text box.

Anybody knows how to do this


  • 2
2 Solutions
mbarbosa, Just for reading,


from eVB ce help
"EnableHardwareKeyboard" event

This function enables or disables the keyboard.

BOOL EnableHardwareKeyboard (
BOOL bEnable );
[in] Boolean value that specifies whether to enable or disable the keyboard. Set it to TRUE to enable the keyboard or FALSE to disable it.
Return Values
This function always returns TRUE.

The EnableHardwareKeyboard function is useful for applications in which a user can write on the touch screen. When the keyboard is disabled, a user can rest a hand on it without causing spurious keyboard input. Use the disable mode carefully. If an application hangs while the keyboard is disabled, the keyboard is not available to other applications.

When EnableHardwareKeyboard changes the enabled state of the keyboard, it causes menus, tabs, buttons and static controls to repaint themselves, so they can change the way they display keyboard accelerators or other relevant information.



This function synthesizes keystrokes, stylus and mouse motions, and button clicks.

UINT SendInput(
UINT nInputs,
LPINPUT pInputs,
int cbSize );
Specifies how many structures pInputs points to.
Pointer to an array of INPUT structures. Each structure represents an event to be inserted into the keyboard or mouse input stream.
Specifies the size of an INPUT structure. If cbSize is not the size of an INPUT structure, the function will fail.
Return Values
The number of events that the function inserted into the keyboard or mouse input stream indicates success. To get extended error information, call GetLastError.

Windows CE Remarks
Windows CE does not support the INPUT_HARDWARE value in the type field of the INPUT structure referred to by the pInputs parameter.

The SendInput function inserts the events in the INPUT structures serially into the keyboard or mouse input stream. These events aren?t interspersed with other keyboard or mouse input events inserted either by the user (with the keyboard or mouse) or by calls to keybd_event, mouse_event, or other calls to SendInput.



This function synthesizes a keystroke. The system can use such a synthesized keystroke to generate a WM_KEYUP or WM_KEYDOWN message.

VOID keybd_event(
BYTE bScan,
DWORD dwFlags,
DWORD dwExtraInfo );
[in] Specifies a virtual-key code. The code must be a value in the range 1 to 254.
[in] Specifies a hardware scan code for the key.
[in] Specifies various aspects of function operation. An application can use any combination of the following predefined constant values to set the flags. Value Description
KEYEVENTF_KEYUP If specified, the key is being released. If not specified, the key is being depressed.
KEYEVENTF_SILENT If specified, a keystroke is simulated, but no clicking sound is made.

[in] Specifies an additional 32-bit value associated with the key stroke.
Return Values

When keyboard input is disabled with EnableHardwareKeyboard(FALSE), you can simulate keyboard input using keybd_event.

Although keybd_event passes an OEM-dependent hardware scan code to the system, applications should not use the scan code. The system converts scan codes to virtual-key codes internally and clears the up/down bit in the scan code before passing it to applications.

An application can simulate a press of the PRINTSCREEN key in order to obtain a screen snapshot and save it to the clipboard. To do this, call keybd_event with the bVk parameter set to VK_SNAPSHOT, and the bScan parameter set to 0 for a snapshot of the full screen or set bScan to 1 for a snapshot of the active window.

The window receiving keystrokes must have focus; Use GetFocus() / SetFocus()
When a key is pressed Windows sends a series of messages to the focus window, usually beginning with WM_KEYDOWN. If it is a letter or a number, WM_KEYDOWN will be followed with a WM_CHAR message (some functions keys does not generate WM_CHAR and the program must interpret the WM_KEYDOWN). WM_KEYUP is sent when the key is released. if alt is used then WM_SYSKEYDOWN + WM_SYSCHAR is received.
For all the messages, wParam and lParam are used: For WM_KEY??? wParam include the virtual key. For WM_CHAR, wParam the value is the unicode of the character pressed.
GetKeyState(), GetAsyncKeyState() keydb_event and MapVirtualKey() are also relevant.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now