views:

585

answers:

2

In most versions of windows, you can get to the menu by pressing the F10 key, thus avoiding having to use the mouse. This behaviour does not appear to be present in Windows Mobile 5.0, but is desirable as the device I am using will be more keyboard than touch screen driven.

Is there a way of programmatically activating and using the menu on Windows Mobile 5.0, under C++ using either MFC or Windows API calls. I have tried setting the focus of the CFrameWnd and CCeCommandBar classes to no avail.

+1  A: 

After a number of attempts, the following appears to work;

void CMyFrame::OnFocusMenu()
{
  PostMessage(WM_SYSCOMMAND,SC_KEYMENU,0);
}

FWIW, none of the following did, where m_wndCommandBar is the CCeCommandBar toolbar containing the menu;

::SetActiveWindow(m_wndCommandBar.m_hWnd);
m_wndCommandBar.PostMessage(WM_ACTIVATE,WA_ACTIVE,0);
m_wndCommandBar.PostMessage(WM_LBUTTONDOWN,0,0);
m_wndCommandBar.PostMessage(WM_LBUTTONUP,0,0);
m_wndCommandBar.OnActivate(WA_ACTIVE, NULL, FALSE);
m_wndCommandBar.SetFocus();
Shane MacLaughlin
A: 

If by menu, you mean the soft keys, note that they are bound to F1 and F2 respectively.

Serge - appTranslator
On an MFC SDI application you typically have a tool bar, containing File/Edit/View/Help across the top of the screen. In Windows and earlier Windows CE versions, you could press F10 to get to this menu. In mobile 5, this no longer appears to be the case. Could be OEM specific.
Shane MacLaughlin