Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function allows your programs to request that all key presses be sent directly to the requesting application. Normally some buttons are intercepted by the operating system for its own use, but games and input - intensive applications may want access to these buttons for their own use.

Syntax

BOOL AllKeys(
	BOOL bAllKeys
);

Parameters

bAllKeys

[in] If bAllKeys is set to TRUE, this function allows all keyboard events to be sent to the application. (This includes the softkey buttons and back button).

If it is set to FALSE, this function specifies standard keyboard event behavior. Some events including softkey buttons and the back button are not sent to the application.

Return Value

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Sample Code

The following C++ code illustrates how to use AllKeys. In the application that this sample is taken from, a check box is used to set AllKeysto true or false.

Copy Code
// process checkbox
case IDC_ALL_KEYS_CHECK_BOX:
	if (g_AllKeys == true)
	{
		AllKeys(0);// Allow os to intercept some key / button
presses 
		g_AllKeys = false;
		// set button state
		SendMessage(hwndCtl,BM_SETCHECK, BST_UNCHECKED,0);
}
	else
	{
		AllKeys(1); // Do not allow os to intercept button presses 
		g_AllKeys = true;
		//set button state
		SendMessage(hwndCtl,BM_SETCHECK, BST_CHECKED,0);
}

Requirements

Header winuser.h
Windows Mobile Smartphone for Windows Mobile 2003 and later

See Also

Reference

Keyboard Functions