代码之家  ›  专栏  ›  技术社区  ›  Usman Masood

在Windows Mobile联系人中扩展上下文菜单

  •  1
  • Usman Masood  · 技术社区  · 15 年前

    我想在Windows Mobile中扩展联系人上下文菜单。当用户右键单击带有拨号和其他功能的联系人时,我想扩展并添加我自己的项目以执行我的自定义程序。

    2 回复  |  直到 13 年前
        1
  •  1
  •   sagar    13 年前

    我找到了另一个 example 我想这个对你有用

    // Initialize the below code snippet in the beginning of the class
    internal struct SHRGINFO
    {
    public int cbSize;
    public IntPtr hwndClient;
    public int ptDownX;
    public int ptDownY;
    public SHRGFLags dwFlags;
    }
    
    [Flags]
    internal enum SHRGFLags
    {
    SHRG_RETURNCMD = 0x00000001,
    SHRG_NOTIFYPARENT = 0x00000002,
    SHRG_LONGDELAY = 0x00000008,
    SHRG_NOANIMATION = 0x00000010,
    }
    [DllImport("aygshell")]
    extern private static int SHRecognizeGesture(ref SHRGINFO shr);
    
    [DllImport("coredll.dll", SetLastError = true)]
    public static extern IntPtr GetActiveWindow();
    
    
    //call the showContMenu() method in Mouseup or MouseDown event
    public void showContMenu(int x, int y)
    {
    SHRGINFO shr = new SHRGINFO();
    shr.cbSize = Marshal.SizeOf(typeof(SHRGINFO));
    shr.dwFlags = SHRGFLags.SHRG_RETURNCMD;
    shr.ptDownX = x;
    shr.ptDownY = y;
    shr.hwndClient = GetActiveWindow();
    
    int ret = SHRecognizeGesture(ref shr);
    
    if (ret == 1000)
    contextMenu1.Show(this, new System.Drawing.Point(x, y));
    
    }
    
        2
  •  3
  •   Tom van Enckevort    15 年前

    如果安装 Windows Mobile 5 SDK ,您将找到一些相关的示例:

    C:\Program Files\Windows Mobile 5.0 SDK\samples\pocket PC\cpp\win32

    • 名片
    • 收件箱扩展性
    • RealVIEW菜单
    推荐文章