Solved

Keyboard Events on WindowsCE 3.0

Posted on 2001-08-31
6
601 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article shows how to setup the internet connectivity on Windows Mobile Emulator.   I assume that you already have Microsoft Visual Studio, Microsoft Windows Mobile SDK's and the emulator installed. The emulator is available with Visual Studi…
If you are anything like me, you install many apps on your phone and have your life on it, sometimes literally.  When I bought my current phone, a Samsung Galaxy S5 from Verizon, they were only selling the versions with 16 GB internal.  I didn't rea…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now