JumpyNET Posted June 10, 2005 Posted June 10, 2005 (edited) Does any one know how I can get this work? It works right when I pick the icon from the default shell32.dll, but if I pick it from an exe or some other file I lose the "," and the index and sometimes some of the filename as well. I think some of the problems are caused by Len(FileName), but don't know how to fix it. And the declarations could also be wrong. Private Declare Unicode Function SHChangeIconDialogW Lib "shell32" Alias "PickIconDlg" (ByVal hOwner As IntPtr, ByVal szFilename As String, ByVal Reserved As Integer, ByRef lpIconIndex As Integer) As Integer Private Declare Ansi Function SHChangeIconDialogA Lib "shell32" Alias "PickIconDlg" (ByVal hOwner As IntPtr, ByVal szFilename As String, ByVal Reserved As Integer, ByRef lpIconIndex As Integer) As Integer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim FileName As String = "%SystemRoot%\system32\shell32.dll" Dim Index As Integer = 116 Dim Retval As Integer If System.Environment.OSVersion.Platform = PlatformID.Win32NT Then Retval = SHChangeIconDialogW(Me.Handle, FileName, Len(FileName) + 1, Index) Else Retval = SHChangeIconDialogA(Me.Handle, FileName, Len(FileName) + 1, Index) End If Me.Text = FileName & "," & Index End Sub I'm using VB 2005 Express Beta 2. PS: Why the vb tags remove all the backslashes?? Edited June 10, 2005 by JumpyNET Quote
Recommended Posts