|
-
Jul 25th, 2001, 07:10 PM
#1
Thread Starter
New Member
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 =]
-
Jul 25th, 2001, 09:08 PM
#2
|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.
-
Jul 30th, 2001, 07:43 AM
#3
Thread Starter
New Member
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.
=]
-
Aug 1st, 2001, 06:21 PM
#4
Thread Starter
New Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|