当前位置: 首页>>代码示例>>C#>>正文


C# IContextMenu.InvokeCommand方法代码示例

本文整理汇总了C#中IContextMenu.InvokeCommand方法的典型用法代码示例。如果您正苦于以下问题:C# IContextMenu.InvokeCommand方法的具体用法?C# IContextMenu.InvokeCommand怎么用?C# IContextMenu.InvokeCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IContextMenu的用法示例。


在下文中一共展示了IContextMenu.InvokeCommand方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InvokeCommand

        private void InvokeCommand(IContextMenu oContextMenu, uint nCmd, string strFolder, Point pointInvoke)
        {
            CMINVOKECOMMANDINFOEX invoke = new CMINVOKECOMMANDINFOEX();
            invoke.cbSize = cbInvokeCommand;
            invoke.lpVerb = (IntPtr)(nCmd - CMD_FIRST);
            invoke.lpDirectory = strFolder;
            invoke.lpVerbW = (IntPtr)(nCmd - CMD_FIRST);
            invoke.lpDirectoryW = strFolder;
            invoke.fMask = CMIC.UNICODE | CMIC.PTINVOKE |
                ((Control.ModifierKeys & Keys.Control) != 0 ? CMIC.CONTROL_DOWN : 0) |
                ((Control.ModifierKeys & Keys.Shift) != 0 ? CMIC.SHIFT_DOWN : 0);
            invoke.ptInvoke = new POINT(pointInvoke.X, pointInvoke.Y);
            invoke.nShow = SW.SHOWNORMAL;

            oContextMenu.InvokeCommand(ref invoke);
        }
开发者ID:xanthalas,项目名称:Rummage,代码行数:16,代码来源:ShellContextMenu.cs

示例2: InvokeCommand

        /// <summary>
        /// Invokes a specific command from an IContextMenu
        /// </summary>
        /// <param name="iContextMenu">the IContextMenu containing the item</param>
        /// <param name="cmdA">the Ansi execute string to invoke</param>
        /// <param name="cmdW">the Unicode execute string to invoke</param>
        /// <param name="parentDir">the parent directory from where to invoke</param>
        /// <param name="ptInvoke">the point (in screen coördinates) from which to invoke</param>
        public static void InvokeCommand(IContextMenu iContextMenu, string cmd, string parentDir, Point ptInvoke)
        {
            ShellAPI.CMINVOKECOMMANDINFOEX invoke = new ShellAPI.CMINVOKECOMMANDINFOEX();
            invoke.cbSize = ShellAPI.cbInvokeCommand;
            invoke.lpVerb = Marshal.StringToHGlobalAnsi(cmd);
            invoke.lpDirectory = parentDir;
            invoke.lpVerbW = Marshal.StringToHGlobalUni(cmd);
            invoke.lpDirectoryW = parentDir;
            invoke.fMask = ShellAPI.CMIC.UNICODE | ShellAPI.CMIC.PTINVOKE |
                ((Control.ModifierKeys & Keys.Control) != 0 ? ShellAPI.CMIC.CONTROL_DOWN : 0) |
                ((Control.ModifierKeys & Keys.Shift) != 0 ? ShellAPI.CMIC.SHIFT_DOWN : 0);
            invoke.ptInvoke = new ShellAPI.POINT(ptInvoke.X, ptInvoke.Y);
            invoke.nShow = ShellAPI.SW.SHOWNORMAL;

            iContextMenu.InvokeCommand(ref invoke);
        }
开发者ID:AdvSofTech,项目名称:BackupWiz,代码行数:24,代码来源:BrowserContextMenuWrappers.cs

示例3: InvokeCommand

        /// <summary>
        /// Invokes a specific command from an IContextMenu
        /// </summary>
        /// <param name="iContextMenu">the IContextMenu containing the item</param>
        /// <param name="cmd">the execute string to invoke</param>
        /// <param name="parentDir">the parent node from where to invoke</param>
        /// <param name="ptInvoke">the point (in screen coцrdinates) from which to invoke</param>
        public static void InvokeCommand(IContextMenu iContextMenu, string cmd, string parentDir, Point ptInvoke)
        {
            CMINVOKECOMMANDINFOEX invoke = new CMINVOKECOMMANDINFOEX();
            invoke.Size = Marshal.SizeOf(typeof(CMINVOKECOMMANDINFOEX));
            invoke.Verb = Marshal.StringToHGlobalAnsi(cmd);
            invoke.Directory = parentDir;
            invoke.VerbW = Marshal.StringToHGlobalUni(cmd);
            invoke.DirectoryW = parentDir;
            invoke.Mask = CMIC.Unicode | CMIC.PtInvoke |
                ((Control.ModifierKeys & Keys.Control) != 0 ? CMIC.ControlDown : 0) |
                ((Control.ModifierKeys & Keys.Shift) != 0 ? CMIC.ShiftDown : 0);
            invoke.InvokePoint = new POINT(ptInvoke);
            invoke.ShowType = SW.ShowNormal;

            iContextMenu.InvokeCommand(ref invoke);
        }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:23,代码来源:ContextMenuHelper.cs

示例4: InvokeCommand

 private static void InvokeCommand(IContextMenu oContextMenu, uint nCmd, string strFolder, Point pointInvoke)
 {
     var invoke = new Structs.Cminvokecommandinfoex
     {
         cbSize = CbInvokeCommand,
         lpVerb = (IntPtr) (nCmd - CmdFirst),
         lpDirectory = strFolder,
         lpVerbW = (IntPtr) (nCmd - CmdFirst),
         lpDirectoryW = strFolder,
         fMask = Enums.Cmic.UNICODE | Enums.Cmic.PTINVOKE | ((Control.ModifierKeys & Keys.Control) != 0 ? Enums.Cmic.CONTROL_DOWN : 0) | ((Control.ModifierKeys & Keys.Shift) != 0 ? Enums.Cmic.SHIFT_DOWN : 0),
         ptInvoke = new Structs.Point(pointInvoke.X, pointInvoke.Y),
         nShow = Enums.Sw.SHOWNORMAL
     };
     oContextMenu.InvokeCommand(ref invoke);
 }
开发者ID:Belial09,项目名称:Fesslersoft-WindowsAPI,代码行数:15,代码来源:ContextMenu.cs

示例5: ExecuteVerb

 public static bool ExecuteVerb(IWin32Window owner, string verb, string parentName, IContextMenu contextMenu)
 {
     if (contextMenu == null)
     {
         return false;
     }
     CMINVOKECOMMANDINFOEX structure = new CMINVOKECOMMANDINFOEX();
     try
     {
         structure.cbSize = Marshal.SizeOf(structure);
         if (verb != null)
         {
             structure.lpVerb = Marshal.StringToHGlobalAnsi(verb);
             structure.lpVerbW = Marshal.StringToHGlobalUni(verb);
         }
         if (!string.IsNullOrEmpty(parentName))
         {
             structure.lpDirectory = parentName;
             structure.lpDirectoryW = parentName;
         }
         if (owner != null)
         {
             structure.hwnd = owner.Handle;
         }
         structure.fMask = (CMIC.UNICODE | (((Control.ModifierKeys & Keys.Control) > Keys.None) ? CMIC.CONTROL_DOWN : ((CMIC) 0))) | (((Control.ModifierKeys & Keys.Shift) > Keys.None) ? CMIC.SHIFT_DOWN : ((CMIC) 0));
         structure.nShow = SW.SW_SHOWNORMAL;
         contextMenu.InvokeCommand(ref structure);
         Marshal.ReleaseComObject(contextMenu);
     }
     finally
     {
         Marshal.FreeHGlobal(structure.lpVerb);
         Marshal.FreeHGlobal(structure.lpVerbW);
     }
     return true;
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:36,代码来源:ShellContextMenuHelper.cs

示例6: InvokeCommand

        /// <summary>
        /// Invokes a specific command from an IContextMenu
        /// </summary>
        /// <param name="iContextMenu">the IContextMenu containing the item</param>
        /// <param name="cmd">the index of the command to invoke</param>
        /// <param name="parentDir">the parent directory from where to invoke</param>
        /// <param name="ptInvoke">the point (in screen coördinates) from which to invoke</param>
        public static void InvokeCommand(IContextMenu iContextMenu, uint cmd, string parentDir, Point ptInvoke)
        {
            NativeShellAPI.CMINVOKECOMMANDINFOEX invoke = new NativeShellAPI.CMINVOKECOMMANDINFOEX();
            invoke.cbSize = NativeShellAPI.cbInvokeCommand;
            invoke.lpVerb = (IntPtr)cmd;
            invoke.lpDirectory = parentDir;
            invoke.lpVerbW = (IntPtr)cmd;
            invoke.lpDirectoryW = parentDir;
            invoke.fMask = NativeShellAPI.CMIC.UNICODE | NativeShellAPI.CMIC.PTINVOKE |
                ((Control.ModifierKeys & Keys.Control) != 0 ? NativeShellAPI.CMIC.CONTROL_DOWN : 0) |
                ((Control.ModifierKeys & Keys.Shift) != 0 ? NativeShellAPI.CMIC.SHIFT_DOWN : 0);
            invoke.ptInvoke = new NativeShellAPI.POINT(ptInvoke.X, ptInvoke.Y);
            invoke.nShow = NativeShellAPI.SW.SHOWNORMAL;

            iContextMenu.InvokeCommand(ref invoke);
        }
开发者ID:xeno-by,项目名称:datavault,代码行数:23,代码来源:BrowserContextMenuWrappers.cs


注:本文中的IContextMenu.InvokeCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。