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.
4/14/2010

When a user presses the Backkey in a dialog box that does not have any edit controls, the Backkey sends a Windows Embedded CE WM_COMMANDmessage with the command ID IDCANCELto the dialog box. The following code example illustrates how to handle the WM_COMMANDmessage.

Copy Code
BOOL rb;
int rc;

{
	switch(LOWORD(wParam))
	{
		// User closes the dialog box by pressing the Back key.
		{
			rb = EndDialog(hwnd, 0);
			if (rb == FALSE)  // EndDialog failed.
			{
				rc = MessageBox(NULL, _T("Could not destroy dialog
box."),
								_T("Error"), MB_OK);
				if (rc == 0)  // Not enough memory to create
MessageBox.
					return E_OUTOFMEMORY;
				return E_FAIL;  // Replace with specific error
handling.
		}
			else  // EndDialog succeeded.
				return S_OK;
	}  // case IDCANCEL
}  // switch
	break;  // from case WM_COMMAND
}

See Also

Concepts

Navigation Keys