Extracts a single icon from a file. This file can be an executable (.exe) file, a dynamic link libr
Extracts a single icon from a file. This file can be an executable (.exe) file, a dynamic link library (.dll), or an icon file (.ico).
API Declarations
Rate Extracts a single icon from a file. This file can be an executable (.exe) file, a dynamic link libr
(1(1 Vote))
' C:\MyApp\Prog.exe on window Form1. The icon must be destroyed after the
' program finishes using it.
Dim hIcon As Long ' handle to the function gotten from the executable file
Dim retval As Long ' return value
' Extract the first icon stored in the aforementioned executable file.
hIcon = ExtractIcon(App.hInstance, "C:\MyApp\Prog.exe", 0)
' Only attempt to display the icon if we successfully extracted it.
If hIcon = 0 Then
Debug.Print "Failed to extract the icon -- aborting."
End ' terminate the program
Else
' Display the icon at coordinates (100, 75) on window Form1.
retval = DrawIcon(Form1.hDC, 100, 75, hIcon)
' Although the icon's image is still visible, the icon itself is not in use.
' Therefore we destroy it to free up resources.
retval = DestroyIcon(hIcon)
End If
Extracts a single icon from a file. This file can be an executable (.exe) file, a dynamic link libr Comments
No comments yet — be the first to post one!
Post a Comment