void IContextMenu.GetCommandString(int idCmd, GetCommandStringFlags uType, int pwReserved, IntPtr pszName, int cchMax)
        {
            if ((uType & GetCommandStringFlags.GCS_HELPTEXT) != GetCommandStringFlags.GCS_HELPTEXT) return;

            int S0 = 0;
            string text = OnMenuSelected(FindMenu(m_CtxMenu.MenuItems, idCmd, ref S0)) + "\0";
            if (text.Length < cchMax)
                cchMax = text.Length;

            if ((uType & GetCommandStringFlags.GCS_UNICODE) == GetCommandStringFlags.GCS_UNICODE)
                Marshal.Copy(text.ToCharArray(), 0, pszName, cchMax);
            else
                Marshal.Copy(Encoding.ASCII.GetBytes(text), 0, pszName, cchMax);
        }
Exemplo n.º 2
0
 void IContextMenu.GetCommandString(int idCmd, GetCommandStringFlags uFlags, int pwReserved, StringBuilder commandString, int cchMax)
 {
     switch (uFlags)
     {
         case GetCommandStringFlags.Verb:
         case GetCommandStringFlags.VerbW:
             commandString = new StringBuilder(actions_hash[idCmd].Command.Substring(1, cchMax - 1));
             break;
         case GetCommandStringFlags.HelpText:
             commandString = new StringBuilder(actions_hash[idCmd].HelpText.Substring(1, cchMax));
             break;
         case GetCommandStringFlags.Validate:
             break;
     }
 }