本文整理汇总了C#中IContextMenu.GetCommandString方法的典型用法代码示例。如果您正苦于以下问题:C# IContextMenu.GetCommandString方法的具体用法?C# IContextMenu.GetCommandString怎么用?C# IContextMenu.GetCommandString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IContextMenu
的用法示例。
在下文中一共展示了IContextMenu.GetCommandString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCommandStringW
/// <summary>
/// Retrieves the command string for a specific item from an iContextMenu (Unicode)
/// </summary>
/// <param name="iContextMenu">the IContextMenu to receive the string from</param>
/// <param name="idcmd">the id of the specific item</param>
/// <param name="executeString">indicating whether it should return an execute string or not</param>
/// <returns>if executeString is true it will return the executeString for the item,
/// otherwise it will return the help info string</returns>
public static string GetCommandStringW(IContextMenu iContextMenu, uint idcmd, bool executeString)
{
string info = string.Empty;
byte[] bytes = new byte[256];
iContextMenu.GetCommandString(
idcmd,
(executeString ? GCS.VerbW : GCS.HelpTextW),
0,
bytes,
ShellApi.MaxPath);
int index = 0;
while (index < bytes.Length - 1 && (bytes[index] != 0 || bytes[index + 1] != 0))
{
index += 2;
}
if (index < bytes.Length - 1)
{
info = Encoding.Unicode.GetString(bytes, 0, index + 1);
}
return info;
}
示例2: GetCommandStringW
/// <summary>
/// Retrieves the command string for a specific item from an iContextMenu (Unicode)
/// </summary>
/// <param name="iContextMenu">the IContextMenu to receive the string from</param>
/// <param name="idcmd">the id of the specific item</param>
/// <param name="executeString">indicating whether it should return an execute string or not</param>
/// <returns>if executeString is true it will return the executeString for the item,
/// otherwise it will return the help info string</returns>
public static string GetCommandStringW(IContextMenu iContextMenu, uint idcmd, bool executeString)
{
string info = string.Empty;
byte[] bytes = new byte[256];
iContextMenu.GetCommandString(
idcmd,
(executeString ? ShellAPI.GCS.VERBW : ShellAPI.GCS.HELPTEXTW),
0,
bytes,
ShellAPI.MAX_PATH);
int index = 0;
while (index < bytes.Length - 1 && (bytes[index] != 0 || bytes[index + 1] != 0))
{
index += 2;
}
if (index < bytes.Length - 1)
{
info = Encoding.Unicode.GetString(bytes, 0, index + 1);
}
return info;
}
示例3: GetCommandStringA
/// <summary>
/// Retrieves the command string for a specific item from an iContextMenu (Ansi)
/// </summary>
/// <param name="iContextMenu">the IContextMenu to receive the string from</param>
/// <param name="idcmd">the id of the specific item</param>
/// <param name="executeString">indicating whether it should return an execute string or not</param>
/// <returns>if executeString is true it will return the executeString for the item,
/// otherwise it will return the help info string</returns>
public static string GetCommandStringA(IContextMenu iContextMenu, uint idcmd, bool executeString)
{
string info = string.Empty;
byte[] bytes = new byte[256];
iContextMenu.GetCommandString(
idcmd,
(executeString ? GCS.VerbA : GCS.HelpTextA),
0,
bytes,
ShellApi.MaxPath);
int index = 0;
while (index < bytes.Length && bytes[index] != 0)
{
index++;
}
if (index < bytes.Length)
{
info = Encoding.Default.GetString(bytes, 0, index);
}
return info;
}
示例4: GetCommandStringA
/// <summary>
/// Retrieves the command string for a specific item from an iContextMenu (Ansi)
/// </summary>
/// <param name="iContextMenu">the IContextMenu to receive the string from</param>
/// <param name="idcmd">the id of the specific item</param>
/// <param name="executeString">indicating whether it should return an execute string or not</param>
/// <returns>if executeString is true it will return the executeString for the item,
/// otherwise it will return the help info string</returns>
public static string GetCommandStringA(IContextMenu iContextMenu, uint idcmd, bool executeString)
{
string info = string.Empty;
byte[] bytes = new byte[256];
iContextMenu.GetCommandString(
idcmd,
(executeString ? ShellAPI.GCS.VERBA : ShellAPI.GCS.HELPTEXTA),
0,
bytes,
ShellAPI.MAX_PATH);
int index = 0;
while (index < bytes.Length && bytes[index] != 0)
{
index++;
}
if (index < bytes.Length)
{
info = Encoding.Default.GetString(bytes, 0, index);
}
return info;
}