Results 1 to 21 of 21

Thread: VB6 - Get Associated Sm/Lg Icon

Threaded View

  1. #1

    Thread Starter
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Lightbulb VB6 - Get Associated Sm/Lg Icon

    This is a VB6 static (.BAS) module containing one function: GetAssocIcon().

    You pass it a relative or absolute file name, and whether you want a large (32x32) or small (16x16) icon.
    • For .ico files you get back the icon.
    • For programs you get back the program icon (as displayed in Explorer).
    • For data files, documents, etc. you get back the default program's icon.
    • You can also pass it an extension alone, as in ".txt" to get the associated program's icon.

    The icon is returned as a StdPicture (Picture) object, for easy use in native-VB operations such as adding it to an ImageList control, Image control, etc.

    It will almost certainly work in VB5 as well, but I haven't tried that. There should be no special requirements such as a Windows version or any extra dependencies.

    Unlike examples based on ExtractAssociatedIcon() calls, this one offers both the large and small icon formats.

    The attachment contains a small demo project.
    Attached Files Attached Files
    Last edited by dilettante; Aug 7th, 2011 at 01:08 PM. Reason: Reposted attachment, no-DestroyIcon version

Tags for this Thread

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