PDA

Click to See Complete Forum and Search --> : Getting Icon Problem


PRIVATE1
Nov 10th, 2000, 03:21 PM
Heres the Code I'm tring to use

Private Sub cmd_Browse_Click()

On Error GoTo this ' Error handling enabled

With cdb
.DialogTitle = "File to send "
.InitDir = ConfigurationData.SharedFolder
.CancelError = True
.ShowOpen

End With


hIcon = ExtractIcon(App.hInstance, cdb.Filename, 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

Retval = DrawIcon(Me.hDC, 0, 0, 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)



this:

On Error GoTo 0 ' Error handling disabled

End If


End Sub

If I use this
hIcon = ExtractIcon(App.hInstance, "C:\PROGRAM FILES\WINRAR\WINRAR.EXE", 0)

The Code Continiues with out an error but doesn't display the icon

It keeps failing . Can you tell me why ?

[]P

[Edited by PRIVATE1 on 11-10-2000 at 04:26 PM]

PRIVATE1
Nov 10th, 2000, 03:50 PM
I Got it , I was trying to get the icon from a txt file . It needs to be an EXE or dll .


[]P