Solved

Keyboard Events on WindowsCE 3.0

Posted on 2001-08-31
6
605 Views
Last Modified: 2013-12-27
Hi!

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

Regards

Marcos
0
Comment
Question by:mbarbosa
  • 2
6 Comments
 
LVL 3

Expert Comment

by:fordraiders
ID: 6459634
mbarbosa, Just for reading,
http://www.cs.cmu.edu/~pebbles/remotecmd/windowsce/index.html

fordraiders
0
 
LVL 3

Accepted Solution

by:
fordraiders earned 50 total points
ID: 6459655
mbarbosa,
also,
http://www.microsoft.com/MOBILE/developer/technicalarticles/keyboardinput.asp




from eVB ce help
:::
"EnableHardwareKeyboard" event

This function enables or disables the keyboard.

BOOL EnableHardwareKeyboard (
BOOL bEnable );
Parameters
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.

Remarks
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.

::::



next




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

UINT SendInput(
UINT nInputs,
LPINPUT pInputs,
int cbSize );
Parameters
nInputs
Specifies how many structures pInputs points to.
pInputs
Pointer to an array of INPUT structures. Each structure represents an event to be inserted into the keyboard or mouse input stream.
cbSize
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.

Remarks
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.




next



"keybd_event"

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 bVk,
BYTE bScan,
DWORD dwFlags,
DWORD dwExtraInfo );
Parameters
bVk
[in] Specifies a virtual-key code. The code must be a value in the range 1 to 254.
bScan
[in] Specifies a hardware scan code for the key.
dwFlags
[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.


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

Remarks
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.




fordraiders
0
 

Assisted Solution

by:mathought
mathought earned 50 total points
ID: 6503679
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.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I think the most popular question in our Windows Mobile Programming zone is about the backlight - we all want to keep it on when our application is running. Few years ago the function SystemIdleTimerReset() did this job. On our side we had to detec…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question