zoukankan      html  css  js  c++  java
  • wince的.netcf让pda界面支持右键(c#版本)

    Recently i wanted to implement contextmenu withanimation(progress) though there is no direct api or way to do it after hoursof searching on the net i finally found a hack to do it by using win32 dll byP/invoking SHRecognizeGesture in aygshell.dll below pic shows the example ofcontext menu in calendar week view

    // Initialize the below code snippet in thebeginning 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 intSHRecognizeGesture(ref SHRGINFO shr);

         [DllImport("coredll.dll",SetLastError = true)]
         public static extern IntPtr GetActiveWindow();


         //call the showContMenu() method inMouseup or MouseDown event
         public void showContMenu(int x, inty)
         {
             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(refshr);

             if (ret == 1000)
                 contextMenu1.Show(this, newSystem.Drawing.Point(x, y));

         }


    I have used above method in more than two views and it works awesome, if youhave any problem with above snippet you can reach me through email at thebottom of the page and if there is a better way or if managed code exists sharewith us.

  • 相关阅读:
    Hackthebox 渗透测试笔记-popcorn[linux提权]
    HTB 渗透测试笔记-Devel[msvenom][提权]
    HTB 渗透测试笔记-Legacy
    Hackthebox网络不稳定的解决方案
    eslint 常用配置
    第十课之培训课程总结
    第九课 复习之从零开始搭建页面
    第八课之提高开发效率的es6以及函数
    第七课之dva以及前后端交互
    第六课之antd以及组件开发介绍
  • 原文地址:https://www.cnblogs.com/meetrice/p/1702608.html
Copyright © 2011-2022 走看看