本文整理汇总了C#中IShellItem.GetDisplayName方法的典型用法代码示例。如果您正苦于以下问题:C# IShellItem.GetDisplayName方法的具体用法?C# IShellItem.GetDisplayName怎么用?C# IShellItem.GetDisplayName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IShellItem
的用法示例。
在下文中一共展示了IShellItem.GetDisplayName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetParsingName
private static string GetParsingName(IShellItem shellItem)
{
if (shellItem == null)
return null;
string path = null;
IntPtr pszPath = IntPtr.Zero;
int hr = shellItem.GetDisplayName(Shell32.SIGDN.SIGDN_DESKTOPABSOLUTEPARSING, out pszPath);
if (false ==
(hr == HRESULT.S_OK ||
hr == HRESULT.E_INVALIDARG))
throw new COMException("GetParsingName", (int)hr);
if (pszPath != IntPtr.Zero)
{
path = Marshal.PtrToStringAuto(pszPath);
Marshal.FreeCoTaskMem(pszPath);
pszPath = IntPtr.Zero;
}
return path;
}
示例2: GetParsingName
internal static string GetParsingName(IShellItem shellItem) {
if (shellItem == null) { return null; }
string path = null;
IntPtr pszPath = IntPtr.Zero;
HResult hr = shellItem.GetDisplayName(ShellNativeMethods.ShellItemDesignNameOptions.DesktopAbsoluteParsing, out pszPath);
if (hr != HResult.Ok && hr != HResult.InvalidArguments) {
throw new ShellException(LocalizedMessages.ShellHelperGetParsingNameFailed, hr);
}
if (pszPath != IntPtr.Zero) {
path = Marshal.PtrToStringAuto(pszPath);
Marshal.FreeCoTaskMem(pszPath);
pszPath = IntPtr.Zero;
}
return path;
}
示例3: GetFileNameFromShellItem
internal string GetFileNameFromShellItem(IShellItem item)
{
string filename;
item.GetDisplayName(NativeMethods.SIGDN.DESKTOPABSOLUTEPARSING, out filename);
return filename;
}
示例4: GetPathFromShellItem
public static string GetPathFromShellItem(IShellItem item)
{
return item.GetDisplayName(SIGDN.DESKTOPABSOLUTEPARSING);
}
示例5: TraceAction
private static void TraceAction(
string action, IShellItem item, uint hresult)
{
TraceAction(action,
item != null ? item.GetDisplayName(SIGDN.SIGDN_NORMALDISPLAY) : null,
hresult);
}
示例6: GetFileNameFromShellItem
internal static string GetFileNameFromShellItem(IShellItem item)
{
string filename = null;
IntPtr pszString = IntPtr.Zero;
HResult hr = item.GetDisplayName(ShellNativeMethods.ShellItemDesignNameOptions.DesktopAbsoluteParsing, out pszString);
if (hr == HResult.Ok && pszString != IntPtr.Zero)
{
filename = Marshal.PtrToStringAuto(pszString);
Marshal.FreeCoTaskMem(pszString);
}
return filename;
}
示例7: RemoveCustomCategoryItem
private string RemoveCustomCategoryItem(IShellItem item)
{
string path = null;
if (customCategoriesCollection != null)
{
IntPtr pszString = IntPtr.Zero;
HRESULT hr = item.GetDisplayName(ShellNativeMethods.SIGDN.SIGDN_FILESYSPATH, out pszString);
if (hr == HRESULT.S_OK && pszString != IntPtr.Zero)
{
path = Marshal.PtrToStringAuto(pszString);
// Free the string
Marshal.FreeCoTaskMem(pszString);
}
// Remove this item from each category
foreach (JumpListCustomCategory category in customCategoriesCollection)
category.RemoveJumpListItem(path);
}
return path;
}
示例8: GetFileNameFromShellItem
internal static string GetFileNameFromShellItem( IShellItem item )
{
string filename = null;
IntPtr pszString = IntPtr.Zero;
HRESULT hr = item.GetDisplayName( ShellNativeMethods.SIGDN.SIGDN_DESKTOPABSOLUTEPARSING, out pszString );
if (hr == HRESULT.S_OK && pszString != IntPtr.Zero)
{
filename = Marshal.PtrToStringAuto(pszString);
Marshal.FreeCoTaskMem(pszString);
}
return filename;
}
示例9: RemoveCustomCategoryItem
private string RemoveCustomCategoryItem(IShellItem item)
{
string path = null;
if (customCategoriesCollection != null)
{
IntPtr pszString = IntPtr.Zero;
HResult hr = item.GetDisplayName(ShellNativeMethods.ShellItemDesignNameOptions.FileSystemPath, out pszString);
if (hr == HResult.Ok && pszString != IntPtr.Zero)
{
path = Marshal.PtrToStringAuto(pszString);
// Free the string
Marshal.FreeCoTaskMem(pszString);
}
// Remove this item from each category
foreach (JumpListCustomCategory category in customCategoriesCollection)
{
category.RemoveJumpListItem(path);
}
}
return path;
}
示例10: PostCopyItem
public override void PostCopyItem(uint dwFlags, IShellItem psiItem, IShellItem psiDestinationFolder, string pszNewName, uint hrCopy, IShellItem psiNewlyCreated) {
if ((CopyEngineResult)hrCopy != CopyEngineResult.COPYENGINE_OK && (CopyEngineResult)hrCopy != CopyEngineResult.COPYENGINE_S_DONT_PROCESS_CHILDREN) return;
((Dictionary<string, string>)Application.Current.Properties[nameof(AppProps.FileOperationResult)]).Add(
psiItem.GetDisplayName(SIGDN.SIGDN_FILESYSPATH),
psiNewlyCreated.GetDisplayName(SIGDN.SIGDN_FILESYSPATH));
}
示例11: GetFilePathFromShellItem
internal static string GetFilePathFromShellItem(IShellItem item)
{
string str;
unchecked
{
item.GetDisplayName((SIGDN)(-2147319808), out str);
}
return str;
}