Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / January 2006

Tip: Looking for answers? Try searching our database.

Building a ITEMIDLIST from a number of SHITEMID structs

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter Larsen - 30 Jan 2006 18:21 GMT
Hi,

I'm new to C# and need help to build a list if pidl's (ITEMIDLIST).

I am currently working on a shell-browser, and i think i have most of it
done right now - except from the icon stuff.
Up to now i have used SHGetFileInfo to load the icon-index, but its slow and
doest'n work on network drives.

I need to be able to use ShellFolder.GetUIObjectOf (see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platfor
m/shell/reference/ifaces/iextracticon/iextracticon.asp
).

But i can't get this function to work right.
Please show me a working sample of IShellFolder.GetUIObjectOf.
Thank you in advance.
/Peter
Mattias Sjögren - 30 Jan 2006 23:30 GMT
Peter,

>I'm new to C# and need help to build a list if pidl's (ITEMIDLIST).
...
>Please show me a working sample of IShellFolder.GetUIObjectOf.

Do you need it for the third parameter of GetUIObjectOf? Assuming you
store your PIDLs as IntPtrs, you can declare the parameter type as
either ref IntPtr or as IntPtr[] depending on if you're going to pass
in one or multiple identifiers.

Mattias

Signature

Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Peter Larsen - 31 Jan 2006 09:07 GMT
I think my problem is IExtractIcon or the way i deliver SHITEMID.

I have found the interface IShellFolder more than once on the internet, and
i am not sure which on is the right one:

-------------------------------------------------------------------------------
[PreserveSig()]
uint GetUIObjectOf(
   IntPtr hwndOwner,       // Handle to the owner window that the client
               // should specify if it displays
               // a dialog box or message box.
   int cidl,           // Number of file objects or subfolders specified
               // in the apidl parameter.
   [In(), MarshalAs(UnmanagedType.LPArray)] IntPtr[]
   apidl,          // Address of an array of pointers to ITEMIDLIST
               // structures, each of which
               // uniquely identifies a file object or subfolder
               // relative to the parent folder.
   [In()]
   ref Guid riid,      // Identifier of the COM interface object to
           // return.
   IntPtr rgfReserved,     // Reserved.
   [MarshalAs(UnmanagedType.Interface)]
    out object ppv);    // Pointer to the requested interface.
-------------------------------------------------------------------------------

[PreserveSig]
       Int32 GetUIObjectOf(
           IntPtr hwndOwner,   // Handle to the owner window that the
client should specify if it displays
           // a dialog box or message box.
           UInt32 cidl,    // Number of file objects or subfolders
specified in the apidl parameter.
           IntPtr[] apidl,    // Address of an array of pointers to
ITEMIDLIST structures, each of which
           // uniquely identifies a file object or subfolder relative to
the parent folder.
           Guid riid,     // Identifier of the COM interface object to
return.
           ref UInt32 rgfReserved,  // Reserved.
           out IntPtr ppv);   // Pointer to the requested interface.

-------------------------------------------------------------------------------
Peter Larsen - 31 Jan 2006 14:38 GMT
No need of talking about this issue anymore - i have found a way ...

   extractIcon.GetIconLocation(0, iconPath, MAX_PATH, ref iconIndex, ref
pwFlags);

   uint GetIconLocation(int uFlags, [MarshalAs(UnmanagedType.LPStr)]
StringBuilder szIconFile, int
          cchMax, ref int piIndex, ref int pwFlags);

Thanks for your time :-)

> Peter,
>
[quoted text clipped - 8 lines]
>
> Mattias

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.