Results 1 to 4 of 4

Thread: SHChangeIconDialog

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    Sweden
    Posts
    6

    Unhappy SHChangeIconDialog

    I wonder how to use the "SHChangeIconDialog"?
    I found some code(below) but it didn't get me the filename of the selected file.

    here's the code:

    Declare Function SHChangeIconDialog Lib "Shell32.DLL" Alias "#62" (ByVal hWndOwner As Long, ByVal szInitFilename As String, ByVal dwReserved As Long, lpIconIndex As Long) As Long

    Function DisplayChangeIconDialog(FileName As String, Optional ByVal hWndOwner As Long = 0, Optional IconIndex = 0, Optional ByVal GetHandle As Boolean = True) As Long
    Dim a As String
    If SHChangeIconDialog(hWndOwner, FileName, 0, IconIndex) = 0 Then Exit Function ' Failure? Exit Function
    If GetHandle Then
    DisplayChangeIconDialog = ExtractAssociatedIcon(App.hInstance, FileName, IconIndex) ' Extract the icon
    ' Do NOT forget to DeleteObject it when you are done!!!
    Else
    DisplayChangeIconDialog = -1 ' Success but do nothing... FileName and IconIndex are returned ByRef anyway
    End If
    End Function8

    'Ends here

    and this is how I called it


    myicon = DisplayChangeIconDialog(myfile, , iconnum, True)



    please help me =]
    Print Chr(61) & Chr(61)

  2. #2
    jim mcnamara
    Guest
    |Try this:
    Code:
    Private Declare Function SHChangeIconDialog Lib "shell32" Alias "#62" (ByVal hOwner As Long, ByVal szFilename As String, ByVal R As Long, lpIconIndex As Long) As Long
    
    Private Sub Form_Load()
        SHChangeIconDialog Me.hWnd, "shell32.dll", 0, 0
    End Sub
    This api is unsupported, ie., subject to being dropped or changed.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    Sweden
    Posts
    6
    thanks, but that wasn't really my problem

    the problem is how to get the filename from the dialog when I choose to "browse" for a file.

    =]
    Print Chr(61) & Chr(61)

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    Sweden
    Posts
    6

    Unhappy

    please help....
    Print Chr(61) & Chr(61)

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