Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 软件时空 > 软件相关 > ppc中长时间点击的响应(长按)
【标  题】:ppc中长时间点击的响应(长按)
【关键字】:ppc
【来  源】:http://blog.csdn.net/alfiede/archive/2007/04/17/1567727.aspx

ppc中长时间点击的响应(长按)

Your Ad Here

SHRGINFO

This structure sets members for the SHRecognizeGesture function. If a user taps and holds long enough to warrant a context menu, a GN_CONTEXTMENU notification will be returned by the function, or sent to the parent of the control, depending on the values in the SHRGINFO structure.
typedef struct tagSHRGI {
DWORD cbSize;
HWND hwndClient;
POINT ptDown
DWORD dwFlags;
} SHRGINFO, *PSHRGINFO;
Members
cbSize
Sizeof (SHRGINFO).
hwndClient
Handle to the window calling the SHRecognizeGesture function.
ptDown
X and Y client coordinates of the mouse-down position.
dwFlags
Contains one of the values listed in the following table.

Flag
Description
SHRG_RETURNCMD
Return value will be GN_CONTEXTMENU or 0 (zero).
SHRG_NOTIFYPARENT
Parent of hwndClient will receive WM_NOTIFY/GN_CONTEXTMENU.
SHRG_LONGDELAY
This will process a longer delay than the default before it indicates a gesture.

点击右键
在Windows系统里,当您在一个对象上单击鼠标右键,通常地会调出上下文相关的、独立的菜单,显示针对该具体对象能做什么的功能项集合。在有鼠标的系统中,Windows发送WM_RBUTTONDOWN和WM_RBUTTONUP消息,指出右键点击了。但是当使用手写笔的时候,不会有右键。不过Windows CE指导方针中允许您使用手写笔模拟右键点击。指导方针规定,如果用户按下Alt键的同时用手写笔点击屏幕,程序会当成是右键鼠标被点击,并显示相关的上下文菜单。在WM_LBUTTONDOWN的wParam中没有MK_ALT标志,所以判断Alt键是否被按的最好方法是用VK_MENU做参数调用GetKeyState,并测试返回值的相关位是否被设置了。在这种情况下,GetKeyState是最合适的,因为返回的是鼠标消息从消息队列里取出时的键的状态。
在没有键盘的系统上,采取压下并保持这一姿势来模拟鼠标右键点击。SHRecognizeGesture函数可以用在Pocket PC和具有适当Shell组件的嵌入式Windows CE系统中,用来检查压下并保持这一姿势。函数原型如下:
WINSHELLAPI DWORD SHRecongnizeGesture(SHRGINFO * shrg);
唯一的参数是一SHRGINFO结构的地址,该结构定义如下:
typedef struct tagSHRGI{
DWORD cbSize;
HWND hwndClient;
POINT ptDown;
DWORD dwFlags;
}SHRGINFO,*PSHRGINFO;

cbSize需要用结构的大小来填充。hwndClient则需要设置为调用该函数的窗口的句柄。ptDown结构需要用识别出姿势时的点来填充。dwFlags则包含许多标志。SHRG_RETURNCMD标志表示如果用户做出正确的下压保持姿势,则让函数返回GN_CONTEXTMENU;否则就返回0SHRG_NOTIFYPARENT标志表示如果识别出正确姿势的话,就给父窗口发送一个WM_NOTIFY消息。SHRG_LONDELAY消息要求在识别出姿势之前,用户需要保持点压一段时间。 

 

SHRecognizeGesture
This function is typically used by custom controls to recognize certain stylus gestures. The one currently supported gesture is for context menus, where a context menu gesture is defined as when the user presses and holds the stylus in the same spot for some short period of time.
WINSHELLAPI DWORD SHRecognizeGesture(
SHRGINFO * shrg);
Parameters
shrg
Pointer to a SHRGINFO structure.
Return Values
Returns 0 if there was no context menu gesture. If there was a context menu gesture, then one of the following will be returned:
If the dwFlags member of the SHRG structure is SHRG_RETURNCMD, the function will return GN_CONTEXTMENU.
If the dwFlags member of the SHRG structure is SHRG_NOTIFYPARENT, a WM_NOTIFY with GN_CONTEXTMENU will be sent to the parent of shrg->hwndClient, and the function will return whatever the return value from the WM_NOTIFY processing is.
A WM_NOTIFY with GN_CONTEXTMENU will be sent to shrg->hwndClient, and the function will return whatever the return value from the WM_NOTIFY processing is.
Remarks
Typically, a control will call this function during the WM_LBUTTONDOWN processing. If the user presses and holds long enough to warrant a context menu, a GN_CONTEXTMENU notification will be returned by the function, or sent to the parent of the control, depending on the values in the SHRG structure. Note that it is the responsibility of the application processing the GN_CONTEXTMENU notification to bring up the menu.
 
例子:
void CCeButtonST::OnLButtonDown(UINT nFlags, CPoint point)
{
       //==================
       SHRGINFO    shrg;
   
    shrg.cbSize = sizeof(shrg);
    shrg.hwndClient = m_hWnd;
    shrg.ptDown.x = point.x;//LOWORD(lParam);
    shrg.ptDown.y = point.y;//HIWORD(lParam);
shrg.dwFlags = SHRG_RETURNCMD;
// |SHRG_NOANIMATION |SHRG_LONGDELAY
   
    if (::SHRecognizeGesture(&shrg) == GN_CONTEXTMENU)
    {
              //MessageBox(_T("ok"));
              if(m_StSound!=_T(""))
              {
                     PlaySound(m_StSound,NULL,SND_ASYNC);
              }
              #if defined(_WIN32_WCE_PSPC) && (_WIN32_WCE >= 300)
                     SHRecognizeGesture(point);//是否显示圆圈
        #endif // _WIN32_WCE_PSPC
       }else
       {
       //==================
       SetState(TRUE);
#if defined(_WIN32_WCE_PSPC) && (_WIN32_WCE >= 300)
       SHRecognizeGesture(point);
#endif // _WIN32_WCE_PSPC
       Default();
       }
      
       //CButton::OnLButtonDown(nFlags, point);
} // End of OnLButtonDown
联通wap定制退定接口jsp实现:【上一篇】
菜单的扩展性 ( 以下内容适用平台 Microsoft Windows CE 5.0 ):【下一篇】
【相关文章】
  • EVC4.0安装说明,开发ppc2003
  • 如何调试用于PPC设备的dll
  • ppc中右上角的X是后台运行,如何让它以退出应用
  • VS2005开发PPC数据库应用中遇到的几个问题
  • 发行版发布:Slackintosh 11.0[for ppc ver]
  • APPC Programmer's Guide
  • UPPC系统NAT穿透技术
  • 关于设置PPC壁纸 (by 无聊客)
  • PoPToP PPTP + MPPE 128bit Encryption + MPPC Compre
  • JMX设计模式之MBeanForAppConfig模式
  • 【随机文章】
  • ARM指令点滴
  • 用FTP获得密码
  • CSS入门教程
  • Oracle数据库中分区表的操作方法
  • 为什么使用do{}while(0)来进行宏定义
  • 通过JSP的预编译消除性能瓶颈(1)
  • 在JSP中取得在WEB.XML中定义的参数
  • Windows消息 下
  • c source file of merge_sort
  • NORDX/CDT和RiT科技结亲共推新型布线管理方案
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 bbb软讯网络 All Rigths Reserved.