/// <summary> /// Returns the desktop relative pIDL of a special folder /// </summary> /// <param name="desktopIShellFolder">The IShellFolder instance of the Desktop</param> /// <param name="csidl">The CSIDL of the special folder</param> /// <returns>the desktop relative pIDL of a special folder</returns> public static IntPtr initSpecialPIDL(Object desktopIShellFolder, int csidl) { IntPtr result = new IntPtr(); ShellApi.SHGetSpecialFolderLocation(IntPtr.Zero, (ShellApi.CSIDL)csidl, ref result); return(result); }
public static Icon GetFolderIcon(IconSize _size, FolderType _folderType) { // Need to add size check, although errors generated at present! uint flags = ShellApi.SHGFI_ICON | ShellApi.SHGFI_USEFILEATTRIBUTES; if (FolderType.Open == _folderType) { flags += ShellApi.SHGFI_OPENICON; } if (IconSize.Small == _size) { flags += ShellApi.SHGFI_SMALLICON; } else { flags += ShellApi.SHGFI_LARGEICON; } // Get the folder icon ShellApi.SHFILEINFO shfi = new ShellApi.SHFILEINFO(); ShellApi.SHGetFileInfo(null, ShellApi.FILE_ATTRIBUTE_DIRECTORY, out shfi, (uint)Marshal.SizeOf(shfi), flags); // Now clone the icon, so that it can be successfully stored in an ImageList Icon icon = (Icon)Icon.FromHandle(shfi.hIcon).Clone(); Api.DestroyIcon(shfi.hIcon); // Cleanup return(icon); }
/// <summary> /// /// </summary> /// <param name="_fileName"></param> /// <param name="_size"></param> /// <param name="_linkOverlay"></param> /// <returns></returns> public static Icon GetFileIcon(string _fileName, IconSize _size, bool _linkOverlay) { ShellApi.SHFILEINFO shfi = new ShellApi.SHFILEINFO(); uint flags = ShellApi.SHGFI_ICON | ShellApi.SHGFI_USEFILEATTRIBUTES; if (_linkOverlay) { flags += ShellApi.SHGFI_LINKOVERLAY; } if (_size == IconSize.Small) { flags += ShellApi.SHGFI_SMALLICON; } else { flags += ShellApi.SHGFI_LARGEICON; } ShellApi.SHGetFileInfo(_fileName, ShellApi.FILE_ATTRIBUTE_NORMAL, out shfi, (uint)Marshal.SizeOf(shfi), flags); Icon icon = Icon.FromHandle(shfi.hIcon); return(icon); }
private void BecomeComputerBrowser() { _uiFlags += BrowseFlags.BIF_BROWSEFORCOMPUTER; Description = "Select a computer:"; ShellApi.SHGetSpecialFolderLocation(IntPtr.Zero, ShellApi.CSIDL.CSIDL_NETWORK, ref this._rootFolderLocation); ShowNewFolderButton = false; ShowEditBox = false; }
private void mnuOpenFile_Click(object sender, RoutedEventArgs e) { FileItem selectedFile = GetSelectedFile(); if (selectedFile != null) { ShellApi.ShellExecute((IntPtr)0, "open", selectedFile.GetFullPath(), null, selectedFile.DirName, 5); } }
/// <summary> /// Returns the pIDL of the desktop itself /// </summary> public static IntPtr initDesktopPIDL() { IntPtr pidl = new IntPtr(); // get the root shell folder ShellApi.SHGetSpecialFolderLocation(IntPtr.Zero, ShellApi.CSIDL.CSIDL_DESKTOP, ref pidl); return(pidl); }
/// <summary> /// Returns an IShellFolder for the desktop /// </summary> public static Object initDesktopFolder() { ShellApi.IShellFolder rootShell = null; // get the root shell folder ShellApi.SHGetDesktopFolder(ref rootShell); return(rootShell); }
public static string getFolderType(string path) { ShellApi.SHFILEINFO shinfo = new ShellApi.SHFILEINFO(); if (ShellApi.SHGetFileInfo(path, 0, out shinfo, (uint)Marshal.SizeOf(shinfo), ShellApi.SHGFI.SHGFI_TYPENAME) == IntPtr.Zero) { return(null); } return(shinfo.szTypeName); }
public static int getAttribute(string path) { ShellApi.SHFILEINFO shinfo = new ShellApi.SHFILEINFO(); if (ShellApi.SHGetFileInfo(path, 0, out shinfo, (uint)Marshal.SizeOf(shinfo), ShellApi.SHGFI.SHGFI_ATTRIBUTES) == IntPtr.Zero) { return(0); } return((int)shinfo.dwAttributes); }
private void mnuOpenDir_Click(object sender, RoutedEventArgs e) { FileItem selectedFile = GetSelectedFile(); if (selectedFile != null) { ShellApi.ShellExecute((IntPtr)0, "open", "explorer.exe", string.Format("/e,\"{0}\"", selectedFile.DirName), null, 5); } }
public static IntPtr getIcon(String absolutePath, Boolean getLargeIcon) { ShellApi.SHFILEINFO shinfo = new ShellApi.SHFILEINFO(); if (ShellApi.SHGetFileInfo(absolutePath, 0, out shinfo, (uint)Marshal.SizeOf(shinfo), ShellApi.SHGFI.SHGFI_ICON | (getLargeIcon ? ShellApi.SHGFI.SHGFI_LARGEICON : ShellApi.SHGFI.SHGFI_SMALLICON)) == IntPtr.Zero) { return(IntPtr.Zero); } return(shinfo.hIcon); }
private bool DeleteFile(FileItem file) { var sfo = new ShellApi.SHFILEOPSTRUCT() { wFunc = ShellApi.FileFuncFlags.FO_DELETE, fFlags = ShellApi.FILEOP_FLAGS.FOF_ALLOWUNDO | ShellApi.FILEOP_FLAGS.FOF_NOCONFIRMATION, pFrom = file.GetFullPath() + char.MinValue + char.MinValue }; return(ShellApi.SHFileOperation(ref sfo) == 0); }
public static IMalloc GetMalloc() { IntPtr ptrRet; ShellApi.SHGetMalloc(out ptrRet); Object obj = Marshal.GetTypedObjectForIUnknown(ptrRet, GetMallocType()); IMalloc imalloc = (IMalloc)obj; return(imalloc); }
public static string getExecutableType(string path) { StringBuilder objResultBuffer = new StringBuilder(1024); int result = ShellApi.FindExecutable(path, path, objResultBuffer); if (result >= 32) { return(objResultBuffer.ToString()); } return(null); }
public static IShellFolder GetDesktopFolder() { IntPtr ptrRet; ShellApi.SHGetDesktopFolder(out ptrRet); System.Type shellFolderType = System.Type.GetType("ShellLib.IShellFolder"); Object obj = Marshal.GetTypedObjectForIUnknown(ptrRet, shellFolderType); IShellFolder ishellFolder = (IShellFolder)obj; return(ishellFolder); }
private IList <ShellWindow> CreateShellWindows() { var shellWindows = new List <ShellWindow>(); var primary = WpfScreen.Primary; var shellWindow1 = new ShellWindow(); shellWindow1.WindowId = ShellConst.WindowId_Shell1; shellWindow1.Left = primary.DeviceBounds.Left; shellWindow1.Top = primary.DeviceBounds.Top; shellWindow1.Width = primary.DeviceBounds.Width; shellWindow1.Height = primary.DeviceBounds.Height; shellWindow1.Title = primary.DeviceName; shellWindow1.Background = Brushes.YellowGreen; shellWindows.Add(shellWindow1); ShellWindow shellWindow2 = null; var second = WpfScreen.AllScreens().FirstOrDefault(x => !x.IsPrimary); if (second != null) { shellWindow2 = new ShellWindow(); shellWindow2.WindowId = ShellConst.WindowId_Shell2; shellWindow2.Left = second.DeviceBounds.Left; shellWindow2.Top = second.DeviceBounds.Top; shellWindow2.Width = second.DeviceBounds.Width; shellWindow2.Height = second.DeviceBounds.Height; shellWindow2.Title = second.DeviceName; shellWindow2.Background = Brushes.DarkGray; shellWindows.Add(shellWindow2); } var shellApi1 = new ShellApi(this, shellWindow1, shellWindows.ToArray()); shellWindow1.BindShellApi(shellApi1); ShellApiContext.Current.ShellApi1 = shellApi1; if (shellWindow2 != null) { var shellApi2 = new ShellApi(this, shellWindow2, shellWindows.ToArray()); shellWindow2.BindShellApi(shellApi2); ShellApiContext.Current.ShellApi2 = shellApi2; } return(shellWindows); }
private bool DeleteFiles(string[] filePaths) { var totalSize = filePaths.Sum(x => x.Length + 1) + 1; var sb = new System.Text.StringBuilder(totalSize); foreach (var filePath in filePaths) { sb.Append(filePath + '\0'); } sb.Append('\0'); var sfo = new ShellApi.SHFILEOPSTRUCT() { wFunc = ShellApi.FileFuncFlags.FO_DELETE, fFlags = ShellApi.FILEOP_FLAGS.FOF_ALLOWUNDO | ShellApi.FILEOP_FLAGS.FOF_NOCONFIRMATION, pFrom = sb.ToString() }; return(ShellApi.SHFileOperation(ref sfo) == 0); }
public static String getFileSystemPath(int csidl) { IntPtr pIDL = new IntPtr(); int hRes = ShellApi.SHGetSpecialFolderLocation(IntPtr.Zero, (ShellApi.CSIDL)csidl, ref pIDL); if (hRes != 0) { //throw Marshal.ThrowExceptionForHR(hRes); // TODO exception for hRes return(null); } StringBuilder builder = new StringBuilder(1024); if (ShellApi.SHGetPathFromIDList(pIDL, builder)) { return(builder.ToString()); } else { return(null); } }
public static IntPtr extractIcon(Object parentIShellFolder, IntPtr relativePIDL, Boolean getLargeIcon) { if (parentIShellFolder == null || relativePIDL == IntPtr.Zero) { return(IntPtr.Zero); } ShellApi.IShellFolder folder = (ShellApi.IShellFolder)parentIShellFolder; Guid guid = new Guid("000214fa-0000-0000-c000-000000000046"); object ppv; if (folder.GetUIObjectOf(IntPtr.Zero, 1, new IntPtr[] { relativePIDL }, ref guid, IntPtr.Zero, out ppv) == 0) { ShellApi.IExtractIcon extractor = (ShellApi.IExtractIcon)ppv; int size = 1024; StringBuilder path = new StringBuilder(size); int piIndex; uint pwFlags; if (extractor.GetIconLocation((uint)ShellApi.GIL.GIL_FORSHELL, path, size, out piIndex, out pwFlags) == 0) { IntPtr hIconL = new IntPtr(); IntPtr hIconS = new IntPtr(); if (extractor.Extract(path.ToString(), (uint)piIndex, out hIconL, out hIconS, (16 << 16) + 32) == 0) { if (getLargeIcon) { ShellApi.DestroyIcon(hIconS); return(hIconL); } else { ShellApi.DestroyIcon(hIconL); return(hIconS); } } } } return(IntPtr.Zero); }
private static ShellApi.IMalloc GetSHMalloc() { ShellApi.IMalloc[] ppMalloc = new ShellApi.IMalloc[1]; ShellApi.SHGetMalloc(ppMalloc); return(ppMalloc[0]); }
public static void AddToList(String path) { ShellApi.SHAddToRecentDocs((uint)ShellAddRecentDocs.SHARD_PATHW, path); }
public static void ClearList() { ShellApi.SHAddToRecentDocs((uint)ShellAddRecentDocs.SHARD_PIDL, IntPtr.Zero); }
private void AppbarSetPos(ref ShellApi.RECT appRect) { // prepare data structure of message ShellApi.APPBARDATA msgData = new ShellApi.APPBARDATA(); msgData.cbSize = (UInt32)Marshal.SizeOf(msgData); msgData.hWnd = Handle; msgData.uEdge = (UInt32)m_Edge; msgData.rc = appRect; // set postion for the appbar ShellApi.SHAppBarMessage((UInt32)AppBarMessages.SetPos, ref msgData); appRect = msgData.rc; }
private void AppbarGetTaskbarPos(out ShellApi.RECT taskRect) { // prepare data structure of message ShellApi.APPBARDATA msgData = new ShellApi.APPBARDATA(); msgData.cbSize = (UInt32)Marshal.SizeOf(msgData); // get taskbar position ShellApi.SHAppBarMessage((UInt32)AppBarMessages.GetTaskBarPos, ref msgData); taskRect = msgData.rc; }
public void BindShellApi(ShellApi shellApi) { this.ShellApi = shellApi; shellApi.CurrentShell = this; }
private void Bt_open_dst_Click(object sender, EventArgs e) { ShellApi.ShellExecute(this.Handle, "Open", Tx_dst_fname.Text, "", "", 1); }
public bool DoOperation() { ShellApi.SHFILEOPSTRUCT FileOpStruct = new ShellApi.SHFILEOPSTRUCT(); FileOpStruct.hwnd = OwnerWindow; FileOpStruct.wFunc = (uint)Operation; String multiSource = StringArrayToMultiString(SourceFiles); String multiDest = StringArrayToMultiString(DestFiles); FileOpStruct.pFrom = Marshal.StringToHGlobalUni(multiSource); FileOpStruct.pTo = Marshal.StringToHGlobalUni(multiDest); FileOpStruct.fFlags = (ushort)OperationFlags; FileOpStruct.lpszProgressTitle = ProgressTitle; FileOpStruct.fAnyOperationsAborted = 0; FileOpStruct.hNameMappings = IntPtr.Zero; this.NameMappings = new ShellNameMapping[0]; int RetVal; RetVal = ShellApi.SHFileOperation(ref FileOpStruct); ShellApi.SHChangeNotify( (uint)ShellChangeNotificationEvents.SHCNE_ALLEVENTS, (uint)ShellChangeNotificationFlags.SHCNF_DWORD, IntPtr.Zero, IntPtr.Zero); if (RetVal != 0) { return(false); } if (FileOpStruct.fAnyOperationsAborted != 0) { return(false); } // Newly added on 2007/08/29 to make hNameMappings work if (FileOpStruct.hNameMappings != IntPtr.Zero) { // Get MappingTable ShellApi.SHNAMEMAPPINGINDEXSTRUCT mappingIndex = (ShellApi.SHNAMEMAPPINGINDEXSTRUCT)Marshal.PtrToStructure( FileOpStruct.hNameMappings, typeof(ShellApi.SHNAMEMAPPINGINDEXSTRUCT)); // Prepare array this.NameMappings = new ShellNameMapping[mappingIndex.counter]; // Set pointer to first mapping struct IntPtr mover = mappingIndex.firstMappingStruct; for (int i = 0; i < mappingIndex.counter; i++) { ShellApi.SHNAMEMAPPINGSTRUCT oneNameMappingStruct = (ShellApi.SHNAMEMAPPINGSTRUCT)Marshal.PtrToStructure(mover, typeof(ShellApi.SHNAMEMAPPINGSTRUCT)); this.NameMappings[i] = new ShellNameMapping(oneNameMappingStruct.pszOldPath, oneNameMappingStruct.pszNewPath); // move pointer to the next mapping struct mover = (IntPtr)((int)mover + Marshal.SizeOf(typeof(ShellApi.SHNAMEMAPPINGSTRUCT))); } // Free NameMappings in memory ShellApi.SHFreeNameMappings(FileOpStruct.hNameMappings); } return(true); }
private int FolderBrowserCallback(IntPtr hwnd, int msg, IntPtr lParam, IntPtr lpData) { switch (msg) { case BrowseForFolderMessages.BFFM_INITIALIZED: if (this._selectedPath.Length != 0) { PInvoke.User32.SendMessage(new HandleRef(null, hwnd), BrowseForFolderMessages.BFFM_SETSELECTIONW, 1, this._selectedPath); if (this._showEditBox && this._showFullPathInEditBox) { // get handle to the Edit box inside the Folder Browser Dialog _hwndEdit = PInvoke.User32.FindWindowEx(new HandleRef(null, hwnd), IntPtr.Zero, "Edit", null); PInvoke.User32.SetWindowText(_hwndEdit, this._selectedPath); } } break; case BrowseForFolderMessages.BFFM_IUNKNOWN: IntPtr iunknown = lParam; IntPtr iFolderFilterSite; if (iunknown == IntPtr.Zero) { break; } System.Runtime.InteropServices.Marshal.QueryInterface( iunknown, ref IID_IFolderFilterSite, out iFolderFilterSite); Object obj = System.Runtime.InteropServices.Marshal.GetTypedObjectForIUnknown( iFolderFilterSite, System.Type.GetType("ShellLib.IFolderFilterSite")); ShellLib.IFolderFilterSite folderFilterSite = (ShellLib.IFolderFilterSite)obj; FilterByExtension filter = new FilterByExtension(); filter.ValidExtensions = _validExtensions; filter.DontExpandZip = _dontExpandZip; folderFilterSite.SetFilter(filter); break; case BrowseForFolderMessages.BFFM_SELCHANGED: IntPtr pidl = lParam; if (pidl != IntPtr.Zero) { if (((_uiFlags & BrowseFlags.BIF_BROWSEFORPRINTER) == BrowseFlags.BIF_BROWSEFORPRINTER) || ((_uiFlags & BrowseFlags.BIF_BROWSEFORCOMPUTER) == BrowseFlags.BIF_BROWSEFORCOMPUTER)) { // we're browsing for a printer or computer, enable the OK button unconditionally. PInvoke.User32.SendMessage(new HandleRef(null, hwnd), BrowseForFolderMessages.BFFM_ENABLEOK, 0, 1); } else { //IntPtr pszPath = Marshal.AllocHGlobal(MAX_PATH * Marshal.SystemDefaultCharSize); StringBuilder pszPath = new StringBuilder(MAX_PATH); bool haveValidPath = ShellApi.SHGetPathFromIDList(pidl, pszPath); String displayedPath = pszPath.ToString(); // whether to enable the OK button or not. (if file is valid) PInvoke.User32.SendMessage(new HandleRef(null, hwnd), BrowseForFolderMessages.BFFM_ENABLEOK, 0, haveValidPath ? 1 : 0); // Maybe set the Edit Box text to the Full Folder path if (haveValidPath && !String.IsNullOrEmpty(displayedPath)) { if (_showEditBox && _showFullPathInEditBox) { if (_hwndEdit != IntPtr.Zero) { PInvoke.User32.SetWindowText(_hwndEdit, displayedPath); } } if ((_uiFlags & BrowseFlags.BIF_STATUSTEXT) == BrowseFlags.BIF_STATUSTEXT) { PInvoke.User32.SendMessage(new HandleRef(null, hwnd), BrowseForFolderMessages.BFFM_SETSTATUSTEXT, 0, displayedPath); } } } } break; } return(0); }
public static String getFolderType(IntPtr pIDL) { ShellApi.SHFILEINFO fileInfo = new ShellApi.SHFILEINFO(); ShellApi.SHGetFileInfo(pIDL, 0, out fileInfo, (uint)Marshal.SizeOf(fileInfo), ShellApi.SHGFI.SHGFI_PIDL | ShellApi.SHGFI.SHGFI_TYPENAME); return(fileInfo.szTypeName); }
/// Register the AppBar with the OS and sets its appropriate size private void SizeAppBar(ref ShellApi.RECT rt) { AppbarQueryPos(ref rt); Application.DoEvents(); AppbarSetPos(ref rt); Application.DoEvents(); }
private void ResizeAppBar(ref ShellApi.RECT rt) { Point desiredLocation = new Point(rt.Left, rt.Top); if (!this.form.Location.Equals(desiredLocation)) this.form.Location = new Point(rt.Left, rt.Top); Size desiredSize = new Size(rt.Right - rt.Left, rt.Bottom - rt.Top); if (!this.form.Size.Equals(desiredSize)) this.form.Size = desiredSize; }
public void ShowDialog() { m_FullName = ""; m_DisplayName = ""; // Get shell's memory allocator, it is needed to free some memory later IMalloc pMalloc; pMalloc = ShellFunctions.GetMalloc(); IntPtr pidlRoot; if (RootType == RootTypeOptions.BySpecialFolder) { ShellApi.SHGetFolderLocation(hwndOwner, (int)RootSpecialFolder, UserToken, 0, out pidlRoot); } else // m_RootType = RootTypeOptions.ByPath { uint iAttribute; ShellApi.SHParseDisplayName(RootPath, IntPtr.Zero, out pidlRoot, 0, out iAttribute); } ShellApi.BROWSEINFO bi = new ShellApi.BROWSEINFO(); bi.hwndOwner = hwndOwner; bi.pidlRoot = pidlRoot; bi.pszDisplayName = new String(' ', 256); bi.lpszTitle = Title; bi.ulFlags = (uint)DetailsFlags; bi.lParam = 0; bi.lpfn = new ShellApi.BrowseCallbackProc(this.myBrowseCallbackProc); // Show dialog IntPtr pidlSelected; pidlSelected = ShellLib.ShellApi.SHBrowseForFolder(ref bi); // Save the display name m_DisplayName = bi.pszDisplayName.ToString(); IShellFolder isf = ShellFunctions.GetDesktopFolder(); ShellApi.STRRET ptrDisplayName; isf.GetDisplayNameOf(pidlSelected, (uint)ShellApi.SHGNO.SHGDN_NORMAL | (uint)ShellApi.SHGNO.SHGDN_FORPARSING, out ptrDisplayName); String sDisplay; ShellLib.ShellApi.StrRetToBSTR(ref ptrDisplayName, pidlRoot, out sDisplay); m_FullName = sDisplay; if (pidlRoot != IntPtr.Zero) { pMalloc.Free(pidlRoot); } if (pidlSelected != IntPtr.Zero) { pMalloc.Free(pidlSelected); } Marshal.ReleaseComObject(isf); Marshal.ReleaseComObject(pMalloc); }
protected override bool RunDialog(IntPtr hWndOwner) { bool result = false; if (_rootFolderLocation == IntPtr.Zero) { ShellApi.SHGetSpecialFolderLocation(hWndOwner, (ShellApi.CSIDL) this._rootFolder, ref _rootFolderLocation); if (_rootFolderLocation == IntPtr.Zero) { ShellApi.SHGetSpecialFolderLocation(hWndOwner, 0, ref _rootFolderLocation); if (_rootFolderLocation == IntPtr.Zero) { throw new InvalidOperationException("FolderBrowserDialogNoRootFolder"); } } } _hwndEdit = IntPtr.Zero; //_uiFlags = 0; if (_dontIncludeNetworkFoldersBelowDomainLevel) { _uiFlags += BrowseFlags.BIF_DONTGOBELOWDOMAIN; } if (this._newStyle) { _uiFlags += BrowseFlags.BIF_NEWDIALOGSTYLE; } if (!this._showNewFolderButton) { _uiFlags += BrowseFlags.BIF_NONEWFOLDERBUTTON; } if (this._showEditBox) { _uiFlags += BrowseFlags.BIF_EDITBOX; } if (this._showBothFilesAndFolders) { _uiFlags += BrowseFlags.BIF_BROWSEINCLUDEFILES; } if (Control.CheckForIllegalCrossThreadCalls && (Application.OleRequired() != ApartmentState.STA)) { throw new ThreadStateException("DebuggingException: ThreadMustBeSTA"); } IntPtr pidl = IntPtr.Zero; IntPtr hglobal = IntPtr.Zero; try { ShellApi.BROWSEINFO browseInfo = new ShellApi.BROWSEINFO(); hglobal = Marshal.AllocHGlobal(MAX_PATH * Marshal.SystemDefaultCharSize); this._callback = new ShellApi.BrowseCallbackProc(this.FolderBrowserCallback); browseInfo.pidlRoot = _rootFolderLocation; browseInfo.hwndOwner = hWndOwner; browseInfo.pszDisplayName = hglobal; browseInfo.lpszTitle = this._descriptionText; browseInfo.ulFlags = _uiFlags; browseInfo.lpfn = this._callback; browseInfo.lParam = IntPtr.Zero; browseInfo.iImage = 0; pidl = ShellApi.SHBrowseForFolder(ref browseInfo); if (((_uiFlags & BrowseFlags.BIF_BROWSEFORPRINTER) == BrowseFlags.BIF_BROWSEFORPRINTER) || ((_uiFlags & BrowseFlags.BIF_BROWSEFORCOMPUTER) == BrowseFlags.BIF_BROWSEFORCOMPUTER)) { this._selectedPath = Marshal.PtrToStringAuto(browseInfo.pszDisplayName); result = true; } else { if (pidl != IntPtr.Zero) { StringBuilder pszPath = new StringBuilder(MAX_PATH); ShellApi.SHGetPathFromIDList(pidl, pszPath); this._selectedPathNeedsCheck = true; this._selectedPath = pszPath.ToString(); result = true; } } } finally { ShellApi.IMalloc sHMalloc = GetSHMalloc(); sHMalloc.Free(_rootFolderLocation); _rootFolderLocation = IntPtr.Zero; if (pidl != IntPtr.Zero) { sHMalloc.Free(pidl); } if (hglobal != IntPtr.Zero) { Marshal.FreeHGlobal(hglobal); } this._callback = null; } return(result); }
private void AppbarSetPos(ref ShellApi.RECT appRect) { ShellApi.APPBARDATA msgData = new ShellApi.APPBARDATA(); msgData.cbSize = (UInt32)Marshal.SizeOf(msgData); msgData.hWnd = this.form.Handle; msgData.uEdge = (UInt32)_Edge; msgData.rc = appRect; ShellApi.SHAppBarMessage((UInt32)AppBarMessages.SetPos, ref msgData); appRect = msgData.rc; }
public static void disposeIcon(IntPtr hIcon) { ShellApi.DestroyIcon(hIcon); }
private static extern int StrRetToBuf(ref ShellApi.STRRET pstr, IntPtr pIDL, StringBuilder pszBuf, uint cchBuf);