如何以编程方式激活Windows Mobile中的菜单 [英] How to programmatically activate the menu in Windows mobile

查看:101
本文介绍了如何以编程方式激活Windows Mobile中的菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在大多数Windows版本中,您可以通过按F10键进入菜单,从而避免了使用鼠标的麻烦. Windows Mobile 5.0中似乎没有此行为,但这种行为是可取的,因为我使用的设备将比触摸屏驱动的键盘更多.

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.

在C ++下,可以使用MFC或Windows API调用以编程方式激活和使用Windows Mobile 5.0上的菜单.我尝试将CFrameWnd和CCeCommandBar类的焦点设置为无效.

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.

推荐答案

经过多次尝试,以下操作似乎有效;

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

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

FWIW,以下任何一项都不做,其中m_wndCommandBar是包含菜单的CCeCommandBar工具栏;

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();

这篇关于如何以编程方式激活Windows Mobile中的菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆