本文整理汇总了C#中IShellItem类的典型用法代码示例。如果您正苦于以下问题:C# IShellItem类的具体用法?C# IShellItem怎么用?C# IShellItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IShellItem类属于命名空间,在下文中一共展示了IShellItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostNewItem
public virtual void PostNewItem(uint dwFlags,
IShellItem psiDestinationFolder, string pszNewName,
string pszTemplateName, uint dwFileAttributes,
uint hrNew, IShellItem psiNewItem)
{
TraceAction("PostNewItem", psiNewItem, hrNew);
}
示例2: 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;
}
示例3: TraceAction
private static void TraceAction(string action, IShellItem item, uint hresult)
{
//TraceAction(action,
// item != null ? Marshal.PtrToStringUni(item.GetDisplayName(WindowsAPI.SIGDN.NORMALDISPLAY)) : null,
// hresult);
}
示例4: PostCopyItem
public virtual void PostCopyItem(
uint dwFlags, IShellItem psiItem,
IShellItem psiDestinationFolder, string pszNewName,
uint hrCopy, IShellItem psiNewlyCreated)
{
TraceAction("PostCopyItem", psiNewlyCreated, hrCopy);
}
示例5: PostMoveItem
public void PostMoveItem(
uint dwFlags, IShellItem psiItem,
IShellItem psiDestinationFolder,
string pszNewName, uint hrMove,
IShellItem psiNewlyCreated)
{
TraceAction("PostMoveItem", psiNewlyCreated, hrMove);
}
示例6: GetShellItemFromFolder
private static IShellItem GetShellItemFromFolder(IShellItem shellItem, IShellFolder shellFolder)
{
if (shellItem == null && shellFolder == null)
throw new ArgumentNullException("shellItem, shellFolder", "shellItem and shellFolder cannot both be null");
if (shellItem != null)
return shellItem;
IdList pidl = SHGetIDListFromObject(shellFolder);
return SHCreateItemFromIDList<IShellItem>(pidl);
}
示例7: ShellFolder
internal ShellFolder(IShellItem shellItem, IShellFolder shellFolder, ShellItemKnownInfo knownInfo)
: base(GetShellItemFromFolder(shellItem, shellFolder), knownInfo)
{
if (shellFolder == null)
{
shellFolder = (IShellFolder)shellItem.BindToHandler(null, ShellConsts.BHID_SFObject, typeof(IShellFolder).GUID);
}
NativeFolder = shellFolder;
}
示例8: PidlFromShellItem
internal static IntPtr PidlFromShellItem(IShellItem nativeShellItem)
{
IntPtr shellItem = Marshal.GetComInterfaceForObject(nativeShellItem, typeof(IShellItem));
IntPtr pidl;
int retCode = ShellNativeMethods.SHGetIDListFromObject(shellItem, out pidl);
return (CoreErrorHelper.Succeeded(retCode) ? pidl : IntPtr.Zero);
}
示例9: GetItemAt
public HResult GetItemAt(uint dwIndex, out IShellItem ppsi) {
int index = (int)dwIndex;
if (index < shellItemsList.Count) {
ppsi = shellItemsList[index];
return HResult.Ok;
} else {
ppsi = null;
return HResult.Fail;
}
}
示例10: GetParent
public HResult GetParent(out IShellItem ppsi) {
IntPtr pidl = Shell32.ILClone(Pidl);
if (Shell32.ILRemoveLastID(pidl)) {
ppsi = new ShellItemImpl(pidl, true);
return HResult.S_OK;
}
else {
ppsi = null;
return HResult.MK_E_NOOBJECT;
}
}
示例11: GetItemAt
public HRESULT GetItemAt(uint dwIndex, out IShellItem ppsi)
{
int index = (int)dwIndex;
if (index < shellItemsList.Count)
{
ppsi = shellItemsList[index];
return HRESULT.S_OK;
}
else
{
ppsi = null;
return HRESULT.E_FAIL;
}
}
示例12:
void IShellItemArray.GetItemAt(uint dwIndex, out IShellItem ppsi)
{
int index = (int)dwIndex;
if (index < shellItemsList.Count)
{
ppsi = shellItemsList[index];
//return HResult.S_OK;
}
else
{
ppsi = null;
//return HResult.S_FALSE;
}
}
示例13: PostDeleteItem
public override void PostDeleteItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiItem, uint hrDelete, IShellItem psiNewlyCreated) {
//base.PostDeleteItem(dwFlags,psiItem,hrDelete,psiNewlyCreated);
//if (hrDelete == 2555912) {
// var theNewItem = FileSystemListItem.InitializeWithIShellItem(this._View.LVHandle, psiItem);
// if (this._View.CurrentFolder.Equals(theNewItem.Parent)) {
// Shell32.SHChangeNotify(
// theNewItem.IsFolder ? Shell32.HChangeNotifyEventID.SHCNE_RMDIR : Shell32.HChangeNotifyEventID.SHCNE_DELETE,
// Shell32.HChangeNotifyFlags.SHCNF_IDLIST | Shell32.HChangeNotifyFlags.SHCNF_FLUSH, theNewItem.PIDL, IntPtr.Zero);
// }
// theNewItem.Dispose();
//}
//if (psiItem != null) {
// Marshal.FinalReleaseComObject(psiItem);
//}
// if (psiNewlyCreated != null) {
// Marshal.FinalReleaseComObject(psiNewlyCreated);
// }
//Shell32.SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1);
}
示例14: 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;
}
示例15: PostCopyItem
public override void PostCopyItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiItem, IShellItem psiDestinationFolder, string pszNewName, uint hrCopy, IShellItem psiNewlyCreated) {
//if (hrCopy == 0) {
// var destination = FileSystemListItem.InitializeWithIShellItem(this._View.LVHandle, psiDestinationFolder);
// if (destination.Equals(this._View.CurrentFolder)) {
// var theNewItem = FileSystemListItem.InitializeWithIShellItem(this._View.LVHandle, psiNewlyCreated);
// Shell32.SHChangeNotify(
// theNewItem.IsFolder ? Shell32.HChangeNotifyEventID.SHCNE_MKDIR : Shell32.HChangeNotifyEventID.SHCNE_CREATE,
// Shell32.HChangeNotifyFlags.SHCNF_IDLIST | Shell32.HChangeNotifyFlags.SHCNF_FLUSH, theNewItem.PIDL, IntPtr.Zero);
// this._View.LargeImageList.SupressThumbnailGeneration(false);
// Shell32.SHChangeNotify(Shell32.HChangeNotifyEventID.SHCNE_UPDATEITEM,
// Shell32.HChangeNotifyFlags.SHCNF_IDLIST | Shell32.HChangeNotifyFlags.SHCNF_FLUSH, theNewItem.PIDL, IntPtr.Zero);
// theNewItem.Dispose();
// }
// destination.Dispose();
//}
//if (psiItem != null) {
// Marshal.FinalReleaseComObject(psiItem);
//}
//if (psiNewlyCreated != null) {
// Marshal.FinalReleaseComObject(psiNewlyCreated);
//}
//Shell32.SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1);
}