Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How To Get An Icon From An EXE
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00436737
Message ID:
00436791
Views:
26
>In the registry under HKEY_CLASSES_ROOT, for an MS Word document there is an entry entitled .DOC.
>
>The default value for it is set to "Word.Document.8"
>
>When I scroll down to "Word.Document.8", there is a node entitled DefaultIcon, which has it's default
>value set to:
>
>C:\Program Files\Microsoft Office\Office\Winword.exe,1
>

>
>Armed with the above info, I now know that the icon used to display Word documents is the first icon in the Winword.Exe.

No, it's actually the second. The icon offsets are zero based, so the first icon would be 0.

>How can I use this information to display file type icons in a TreeView control? In other words, how can I "extract" the icon from the EXE and use
>it in the treeview/imagelist controls?

You can't. The treeview requires an image in an ImageList control. In turn, the ImageList control requires either a file or a graphic cell from the PictureClip control (which can contain a number of images from a single file). While you can use the API to retrieve an icon handle from a DLL or executable and display using the DrawIcon() function from Shell32, the treeview can't use that.

I think that Bela Bodecs may have written something that's available in the download section that can do this. I recall there was some talk about his doing so, but don't know for certain whether or not he did.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform