PC Review


Reply
Thread Tools Rate Thread

How to define iShellFolder in VB.NET?

 
 
Nicola Garone
Guest
Posts: n/a
 
      5th Apr 2004
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
Function ParseDisplayName(ByVal IntPtr As Long, bla bla bla ) as
long
Function...
End Interface

or should I use tlbimport, edit it manually (how?) and... what?

I've read a lot of documents but I can't find a complete walktrough, can
someone help me please?

Thanks in advance.
Nicola




 
Reply With Quote
 
 
 
 
Robin Tucker
Guest
Posts: n/a
 
      5th Apr 2004
Yes, you need to do this yourself. Here is my version. I hasn't been fully
tested but seems to work for the bits I use . Note that you will need to
define SHCONTF and STRRET (can be found in MSDN) and modify parameters as
required.

' /////////////////////////////////////////////////////////////////////////
' //
' // IShellFolder
' //
' /////////////////////////////////////////////////////////////////////////

<ComImport(), InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
Guid("000214E6-0000-0000-C000-000000000046")> _
Public Interface IShellFolder

'
/////////////////////////////////////////////////////////////////////////
' //
'
/////////////////////////////////////////////////////////////////////////
<PreserveSig()> _
Function ParseDisplayName(ByVal hwnd As IntPtr, ByVal pbc As IntPtr,
<MarshalAs(UnmanagedType.LPWStr)> ByVal pszDisplayName As String, ByRef
pchEaten As Integer, ByRef ppidl As IntPtr, ByRef pdwAttributes As Integer)
As Integer

'
/////////////////////////////////////////////////////////////////////////
' //
'
/////////////////////////////////////////////////////////////////////////
<PreserveSig()> _
Function EnumObjects(ByVal hwnd As IntPtr, ByVal grfFlags As
COM.ShellAPI.SHCONTF, ByRef ppenumIDList As IntPtr) As Int32

'
/////////////////////////////////////////////////////////////////////////
' //
'
/////////////////////////////////////////////////////////////////////////
<PreserveSig()> _
Function BindToObject(ByVal pidl As IntPtr, ByVal pbc As IntPtr, ByRef
riid As Guid, ByRef ppv As IntPtr) As Int32

'
/////////////////////////////////////////////////////////////////////////
' //
'
/////////////////////////////////////////////////////////////////////////
<PreserveSig()> _
Function BindToStorage(ByVal pidl As IntPtr, ByVal pbc As IntPtr, ByRef
riid As Guid, ByRef ppv As IntPtr) As Int32

'
/////////////////////////////////////////////////////////////////////////
' //
'
/////////////////////////////////////////////////////////////////////////
<PreserveSig()> _
Function CompareIDs(ByVal lParam As Int32, ByVal pidl1 As IntPtr, ByVal
pidl2 As IntPtr) As Int32

'
/////////////////////////////////////////////////////////////////////////
' //
'
/////////////////////////////////////////////////////////////////////////
<PreserveSig()> _
Function CreateViewObject(ByVal hwndOwner As IntPtr, ByVal riid As Guid,
ByRef ppv As IntPtr) As Int32

'
/////////////////////////////////////////////////////////////////////////
' //
'
/////////////////////////////////////////////////////////////////////////
<PreserveSig()> _
Function GetAttributesOf(ByVal cidl As Integer, ByRef apidl As IntPtr,
ByRef rgfInOut As Integer) As Integer

'
/////////////////////////////////////////////////////////////////////////
' //
'
/////////////////////////////////////////////////////////////////////////
<PreserveSig()> _
Function GetUIObjectOf(ByVal hwndOwner As IntPtr, ByVal cidl As UInt32,
ByVal apidl() As IntPtr, ByVal riid As Guid, ByRef rgfReserved As UInt32,
ByRef ppv As IntPtr) As Int32

'
/////////////////////////////////////////////////////////////////////////
' //
'
/////////////////////////////////////////////////////////////////////////
<PreserveSig()> _
Function GetDisplayNameOf(ByVal pidl As IntPtr, ByVal uFlags As Integer,
ByRef pName As COM.ShellAPI.STRRET) As Int32

'
/////////////////////////////////////////////////////////////////////////
' //
'
/////////////////////////////////////////////////////////////////////////
<PreserveSig()> _
Function SetNameOf(ByVal hwnd As IntPtr, ByVal pidl As IntPtr,
<MarshalAs(UnmanagedType.LPWStr)> ByVal pszName As [String], ByVal uFlags As
UInt32, ByRef ppidlOut As IntPtr) As Int32
End Interface


"Nicola Garone" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
> Function ParseDisplayName(ByVal IntPtr As Long, bla bla bla ) as
> long
> Function...
> End Interface
>
> or should I use tlbimport, edit it manually (how?) and... what?
>
> I've read a lot of documents but I can't find a complete walktrough, can
> someone help me please?
>
> Thanks in advance.
> Nicola
>
>
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
using Ishellfolder in vb.net 2005 Andrius B. Microsoft Dot NET 2 7th Jan 2006 05:45 PM
IshellFolder and Andrius B. Microsoft Dot NET 1 4th Jan 2006 08:21 PM
IShellFolder::GetAttributesOf Edwin Knoppert Microsoft ASP .NET 1 1st Dec 2005 05:16 AM
IShellFolder::BindToObject() problem Melinda Microsoft C# .NET 2 18th Jul 2004 07:17 PM
How to define iShellFolder in VB.NET? Nicola Garone Microsoft Dot NET 0 5th Apr 2004 04:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:58 PM.