Results 1 to 3 of 3

Thread: [RESOLVED] Listing desktop icons

  1. #1

    Thread Starter
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Resolved [RESOLVED] Listing desktop icons

    I need to obtain a list of desktop icons and add them to a ListView. I'm currently doing this:

    VB.NET Code:
    1. For Each dIcon In My.Computer.FileSystem.GetFiles(My.Computer.FileSystem.SpecialDirectories.Desktop)
    2.             Dim DesktopIconImageList As System.Drawing.Icon = Icon.ExtractAssociatedIcon(dIcon)
    3.  
    4.             DesktopImages.Images.Add(DesktopIconImageList.ToBitmap)
    5.  
    6.             lvwDesktopIcons.Items.Add(dIcon, DesktopImages.Images.Count - 1)
    7.         Next

    It points to the direct path the icons should be located under the user profile. However, for some reason I've yet to determine, not all of the icons are in this directory.

    Does anyone know of a better method to obtain the desktop icons?

    Thanks
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Listing desktop icons

    There are two desktops: one for all users and for for the current user. The same goes for the Start menu. You probably have some shortcuts on the common desktop. If an app is installed for all users then it will place its shortcuts in the common locations, not the current user locations.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: Listing desktop icons

    Ah. Gotcha. That makes more sense. I guess this wasn't really a VB question at all then. My mistake
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width