Post by Chris Donahu » Sat, 20 Sep 1997 04:00:00

I am trying to get the associated executable file and icon of a document
with a specific extension.  For example, I use the following code to try
to get the path to Notepad.exe:

dim y as string
dim tempIconHandle as long
dim tempWord as long

y = "c:\files\file1.txt"
tempIconHandle = ExctractAssociatedIcon(Me.hWnd, y, tempWord)

My question is: does ExtractAssociatedIcon return the executable's file
path by reference?  I can't seem to get the filepath back from the
function.  Any guidance with regards to this function would be very

Chris Donahue


1. ExtractAssociatedIcon


I've just started using API calls. I used ExtractIcon
(copied straight out of a book) and got the expected
result. Then I tried to use ExtractAssociatedIcon using
the following code.

Declare Function MyExtractAssociatedIcon Lib "shell32.dll"
Alias "ExtractAssociatedIcon" _
        (ByVal hInst As Long, ByVal lpIconPath As String, _
            ByVal lpiIcon As Integer) As Long

Sub hIconToPicture()

Dim strIconFilePath As String
Dim hIcon As Long
Dim intLpiIcon As Integer

strIconFilePath = "C:\Program Files\Microsoft
intLpiIcon = 0

hIcon = MyExtractAssociatedIcon(0, strIconFilePath,

Form1.Picture1.Picture = GPicTool.IconToPicture(hIcon)

End Sub

And VB returned the following error:

'453' Can't find DLL entry point ExtractAssociatedIcon in

Is this because of syntax, logic .?


2. vector art

3. ExtractAssociatedIcon into ImageList?

4. Targa 2000 card and xpanse card

5. ExtractAssociatedIcon and ListView

6. Softimage classes

7. API: ExtractAssociatedIcon Error etc.

8. mac 21" color monitor worth fixing?

9. ExtractAssociatedIcon

10. ExtractAssociatedIcon() to picture object?

11. ExtractAssociatedIcon

12. Something Like ExtractAssociatedIcon

13. ExtractAssociatedIcon