Hello,
I've been trying to find a way to enumerate all drives- logical and virtual starting at the desktop for an explorer clone. I know how to get the logical drives and icons, but have not found a way to get all the drives and folders.
I think IShellFolder with enumobjects is used but I can't find an example.
Thank you for your help.
2 3990
Heya, Bruce. Welcome to TSDN!
We don't really have a D-flat forum here, but I'll go ahead and move your post to the .NET forum, where one of our resident Experts should be able to help you out.
Hello,
I've been trying to find a way to enumerate all drives- logical and virtual starting at the desktop for an explorer clone. I know how to get the logical drives and icons, but have not found a way to get all the drives and folders.
I think IShellFolder with enumobjects is used but I can't find an example.
Thank you for your help.
-
private void PidlEnumerate()
-
{
-
IntPtr pidlDrives;
-
IntPtr pidlItems = IntPtr.Zero;
-
IShellFolder pShellFolder;
-
IntPtr ppenum = IntPtr.Zero;
-
uint celtFetched = 0;
-
int retValue;
-
ShellApi.STRRET sDisplayName;
-
string pszDisplayName = null;
-
uint uAttr = 0;
-
IMalloc pMalloc;
-
const bool S_OK = true;
-
-
pMalloc = ShellLib.ShellFunctions.GetMalloc();
-
-
pShellFolder = ShellFunctions.GetDesktopFolder();
-
-
retValue = ShellApi.SHGetFolderLocation(IntPtr.Zero, (int) ShellApi.CSIDL.CSIDL_DRIVES, IntPtr.Zero, 0, out pidlDrives);
-
-
pShellFolder.ParseDisplayName(IntPtr.Zero, IntPtr.Zero, pszDisplayName, ref celtFetched, out pidlDrives, ref uAttr);
-
-
//retValue = pShellFolder.BindToObject(pidlDrives, IntPtr.Zero, ShellGUIDs.IID_IShellFolder, out ppenum);
-
retValue = ShellApi.SHBindToParent(pidlDrives, ShellLib.ShellGUIDs.IID_IShellFolder,
-
out ppenum, ref pidlItems);
-
-
retValue = pShellFolder.EnumObjects(this.Handle, (int)ShellApi.SHCONTF.SHCONTF_FOLDERS | (int)ShellApi.SHCONTF.SHCONTF_NONFOLDERS, out ppenum);
-
-
while (retValue = ppenum.Next(1, pidlItems, celtFetched) == S_OK && (celtFetched) == 1)
-
{
-
pShellFolder.GetDisplayNameOf(pidlDrives, (uint)ShellLib.ShellApi.SHGNO.SHGDN_NORMAL
-
| (uint)ShellLib.ShellApi.SHGNO.SHGDN_FORPARSING, out sDisplayName);
-
-
string sDisplay;
-
ShellApi.StrRetToBSTR(ref sDisplayName, pidlDrives, out sDisplay);
-
-
pMalloc.Free(pidlDrives);
-
System.Runtime.InteropServices.Marshal.ReleaseComObject(pMalloc);
-
-
MessageBox.Show(sDisplay);
-
}
-
}
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: rogerclive |
last post by:
Perhaps, there is no bigger sleazy company in the entire Maple Republic
( Canada ) than Matrox Graphics Inc.
I paid $100+ through my nose circa 1999 for Matrox Millenium II and
Mystique.
It...
|
by: Bruno van Dooren |
last post by:
Hi all,
i am having a problems with inheritance.
consider the following:
class A
{
public:
A(int i){;}
};
|
by: TerryWilson |
last post by:
I am developing a web based service tool using asp.net that we will distribute with
our product. This service tool will be used for remotely configuring the product, problem
determination, etc. ...
|
by: DraguVaso |
last post by:
Hi,
I want my appliation to Run a Shortcut on my Desktop. This should be done
regardless the fact if the Shortcut is in the All Users\Desktop or
MyProfile\Desktop and regardless the version of...
|
by: Jim Hubbard |
last post by:
Is it possible to emulate a monitor (create a virtual monitor) using vb.net?
Any code snippets or pointers to helpful articles would be very much
appreciated.
|
by: Maciej Bliziński |
last post by:
Hello Pythonists,
I'd like to write for myself a tiny program that counts time spent on each
virtual desktop (in GNOME). In order to do that, I need my program to
detect the current virtual...
|
by: John Brock |
last post by:
At work we are using a virtual desktop manager called AltDesk
(http://www.astonshell.com/), and it is causing a weird and extremely
annoying problem with the VB.NET application I am developing.
...
|
by: desktop |
last post by:
This page:
http://www.eptacom.net/pubblicazioni/pub_eng/mdisp.html
start with the line: "Virtual functions allow polymorphism on a single
argument". What does that exactly mean?
I guess it...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |