473,804 Members | 1,999 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Implementing an IShellFolder interface?

I need to create my own explorer-style control - I don't seem to have access
to IShellFolder - assuming I need it (which I think I do), how can this be
done? I've imported shell32.dll into my references.

I've seen a C# version of how to do it, but I have no idea how to translate
this into VB :-0.
(C# version below, no idea if it works or not!)

using System.Runtime. InteropServices ;

[Flags()]
enum SHCONTF
{
SHCONTF_FOLDERS = 0x20,
SHCONTF_NONFOLD ERS = 0x40,
SHCONTF_INCLUDE HIDDEN = 0x80,
SHCONTF_INIT_ON _FIRST_NEXT = 0x100,
SHCONTF_NETPRIN TERSRCH = 0x200,
SHCONTF_SHAREAB LE = 0x400,
SHCONTF_STORAGE = 0x800
}

[Flags()]
enum SFGAOF
{
SFGAO_CANCOPY = 0x1,
SFGAO_CANMOVE = 0x2,
SFGAO_CANLINK = 0x4,
SFGAO_STORAGE = 0x8,
SFGAO_CANRENAME = 0x10,
SFGAO_CANDELETE = 0x20,
SFGAO_HASPROPSH EET = 0x40,
SFGAO_DROPTARGE T = 0x100,
SFGAO_CAPABILIT YMASK = 0x177,
SFGAO_ENCRYPTED = 0x2000,
SFGAO_ISSLOW = 0x4000,
SFGAO_GHOSTED = 0x8000,
SFGAO_LINK = 0x10000,
SFGAO_SHARE = 0x20000,
SFGAO_READONLY = 0x40000,
SFGAO_HIDDEN = 0x80000,
SFGAO_DISPLAYAT TRMASK = 0xFC000,
SFGAO_FILESYSAN CESTOR = 0x10000000,
SFGAO_FOLDER = 0x20000000,
SFGAO_FILESYSTE M = 0x40000000,
SFGAO_HASSUBFOL DER = unchecked( (int) 0x80000000 ),
SFGAO_CONTENTSM ASK = unchecked( (int) 0x80000000 ),
SFGAO_VALIDATE = 0x1000000,
SFGAO_REMOVABLE = 0x2000000,
SFGAO_COMPRESSE D = 0x4000000,
SFGAO_BROWSABLE = 0x8000000,
SFGAO_NONENUMER ATED = 0x100000,
SFGAO_NEWCONTEN T = 0x200000,
SFGAO_CANMONIKE R = 0x400000,
SFGAO_HASSTORAG E = 0x400000,
SFGAO_STREAM = 0x400000,
SFGAO_STORAGEAN CESTOR = 0x800000,
SFGAO_STORAGECA PMASK = 0x70C50008
}

[Flags()]
enum SHGNO
{
SHGDN_NORMAL = 0x0,
SHGDN_INFOLDER = 0x1,
SHGDN_FOREDITIN G = 0x1000,
SHGDN_FORADDRES SBAR = 0x4000,
SHGDN_FORPARSIN G = 0x8000,
}

[StructLayout(La youtKind.Sequen tial)]
struct STRRET
{
int uType;
/*
IntPtr pOleStr;
uint uOffset;
*/
[MarshalAs(Unman agedType.ByValA rray, SizeConst=260)] byte[] cStr;
}

[
ComImport(),
Guid("000214E6-0000-0000-C000-000000000046"),
InterfaceType(C omInterfaceType .InterfaceIsIUn known)
]
interface IShellFolder
{
[PreserveSig()]
uint ParseDisplayNam e(
IntPtr hwnd,
IntPtr pbc,
[In(), MarshalAs(Unman agedType.LPWStr )] string pszDisplayName,
out uint pchEaten,
out IntPtr ppidl,
ref uint pdwAttributes);

[PreserveSig()]
uint EnumObjects(
IntPtr hwnd,
SHCONTF grfFlags,
out IEnumIDList ppenumIDList);

[PreserveSig()]
uint BindToObject(
IntPtr pidl,
IntPtr pbc,
[In()] ref Guid riid,
[MarshalAs(Unman agedType.Interf ace)] out object ppv);

[PreserveSig()]
uint BindToStorage(
IntPtr pidl,
IntPtr pbc,
[In()] ref Guid riid,
[MarshalAs(Unman agedType.Interf ace)] out object ppv);

[PreserveSig()]
uint CompareIDs(
int lParam,
IntPtr pidl1,
IntPtr pidl2);

[PreserveSig()]
uint CreateViewObjec t(
IntPtr hwndOwner,
[In()] ref Guid riid,
[MarshalAs(Unman agedType.Interf ace)] out object ppv);

[PreserveSig()]
uint GetAttributesOf (
int cidl,
[In(), MarshalAs(Unman agedType.LPArra y)] IntPtr[] apidl,
[MarshalAs(Unman agedType.LPArra y)] SFGAOF[] rgfInOut);

[PreserveSig()]
uint GetUIObjectOf(
IntPtr hwndOwner,
int cidl,
[In(), MarshalAs(Unman agedType.LPArra y)] IntPtr[] apidl,
[In()] ref Guid riid,
IntPtr rgfReserved,
[MarshalAs(Unman agedType.Interf ace)] out object ppv);

[PreserveSig()]
uint GetDisplayNameO f(
IntPtr pidl,
SHGNO uFlags,
out STRRET pName);

[PreserveSig()]
uint SetNameOf(
IntPtr hwnd,
IntPtr pidl,
[In(), MarshalAs(Unman agedType.LPWStr )] string pszName,
SHGNO uFlags,
out IntPtr ppidlOut);
}

[
ComImport(),
Guid("000214F2-0000-0000-C000-000000000046"),
InterfaceType(C omInterfaceType .InterfaceIsIUn known)
]
interface IEnumIDList {

[PreserveSig()]
uint Next(
int celt,
[MarshalAs(Unman agedType.LPArra y)] IntPtr[] rgelt,
out int pceltFetched);

void Skip(
int celt);

void Reset();

void Clone(
out IEnumIDList ppenum);
}
Nov 20 '05 #1
0 1426

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4462
by: Melinda | last post by:
hi all, i'm having problems with BindToObject(). when i call the method it is throwing a System.NullReferenceException error, but i don't understand why. what i'm trying to do is get a reference to an IShellFolder for a folder of a PIDL that i already have. i'm doing that using by calling BindToObject() of the IShellFolder of the desktop folder, per the documentation. here is some code:
4
2251
by: Robin Tucker | last post by:
I can't get this damned IEnumIDList thing to work correctly. I've got the desktop folder as an IShellObject (which I've verified by being able to get the display name etc. from it). I can also get a pointer to the IEnumIDList object via. GetIEnum. It even allows me to execute the "Fetch" method on the interface (changed from "Next" because next is a VB keyword - in any case, its just a function pointer in the VTable). But COM_pIDL...
2
1067
by: Robin Tucker | last post by:
I've got this nice pidl, enumerated via. IEnumIDList on an IShellFolder (the desktop). I know the pidl is ok, because I can list its display name and its looking good. Now I want to go a level down using this piddle and the BindToObject method on the IShellFolder interface. Here's what I'm doing: This is how I declare the method on my IShellFolder interface. <PreserveSig()> _ Function BindToObject(ByVal pidl As IntPtr, ByVal pbc As...
2
6155
by: Nicola Garone | last post by:
Hi all I'm using VB.net. I need to define an object of type iShellFolder (since I have to call ShGetDesktopfolder API in Shell32.dll). I've created interop.Shell32.dll adding a reference to Shell32.dll, but I can't find any definition of iShellFolder under new Shell32 namespace. Must I define the interface manually? Should I use a module within interface definition: Interface iShellFolder
4
368
by: Nicola Garone | last post by:
Hi all, I need to enumerate pidl in a directory which I got (I think) the rigt pidl, but I don't know how to procede. here is a piece of code (folder is a IShellFolder object and it seems to work correctly) Dim idEnum As IEnumIDList Dim pidEnum As IntPtr folder.EnumObjects(IntPtr.Zero, _
1
1875
by: Nicola Garone | last post by:
Hi all, here I am again :-( , this turn I'm in trouble with IShellFolder.GetUIObjectsOf, which raise an exception while accessing an uninstantiated object (I have Italian version softwares and I litteraly translate the error, the original error may sound a little different). I'm using VB.Net, and I need to access ThumbImage extractor, I got IShellFolder interface object pointing to the Directory where my file is in (in following code...
1
2134
by: Andrius B. | last post by:
Hi. My problem concerns vb .net 2005. I want to use IShellFolder interface for such functions as ParseDisplayname. But how to parse a string - folder name (I mean, adding terminating nullchar or smth.) to parsedisplay method? For exzample, if I want to get PIDL for drive C: , should I use smth. like "C:\" & vbNullChar ??? This code below gets no PIDL (t.i, zero). Private Declare Function SHGetDesktopFolder Lib "shell32.dll" _...
2
2709
by: Andrius B. | last post by:
Hi all. Does anyone can suggest a good webpage or site, where I could read about how to use IShellFolder interface in vb .net ? E.g., I have added reference to IShellFolderEx_TLB.dll, but what next? How to pass ITEMIDLIST structures to IShellFolder components? E.g., I have parsed a name to Parent IShellfolder in order to get an ITEMIDLIST of subfolder, I get its's pointer as PIDL of type IntPtr, but the BidToObject method requires ...
6
8522
by: Raj Wall | last post by:
Hi, I am trying to implement the IEqualityComparer interface for a struct so I can use it as the Key for a Dictionary. My struct declaration has: public struct Ring : IEqualityComparer { .... } and I am trying to implement the Equals and GetHashCode methods.
0
9711
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9591
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10594
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9166
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7631
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.