Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > VB6 > SHChangeIconDialog


Автор: SOY 11.4.2005, 08:18
Function SHChangeIconDialog Lib "shell32" Alias "#62" (ByVal hOwner As Long, ByVal szFilename As String, ByVal Reserved As Long, lpIconIndex As Long) As Long- функция для вызова диалога выбора иконок
используя ее столкнулся с проблемой - не возвращается путь и имя файла.
возвращается только индекс иконки.
может кто сталкивался? Заранее спасибо!!!!!!!!

Автор: Naghual 11.4.2005, 08:37
Так в szFilename должно возвращатся. Что в ней?

Автор: SOY 11.4.2005, 18:19
shell32.dll
и так постоянно

Автор: Exception 12.4.2005, 15:07
Код в студию!

Автор: SOY 12.4.2005, 19:33
Private Const VER_PLATFORM_WIN32_NT = 2
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (ByRef lpVersionInformation As OSVERSIONINFO) As Long
Private Declare Function SHChangeIconDialogA Lib "shell32" Alias "#62" (ByVal hOwner As Long, ByVal szFilename As String, ByVal Reserved As Long, lpIconIndex As Long) As Long
Private Declare Function SHChangeIconDialogW Lib "shell32" Alias "#62" (ByVal hOwner As Long, ByVal szFilename As Long, ByVal Reserved As Long, lpIconIndex As Long) As Long
Dim Path as string, InIcon as Long
'Detect if the program is running under Windows NT
Public Function IsWinNT() As Boolean
Dim myOS As OSVERSIONINFO
myOS.dwOSVersionInfoSize = Len(myOS)
GetVersionEx myOS
IsWinNT = (myOS.dwPlatformId = VER_PLATFORM_WIN32_NT)
End Function
Public Function chooseIcon(ByRef strFile As String, ByRef lngIconNum As Long) As Boolean
Dim str1 As String * 260
Dim lng1 As Long ' Dummy?
Dim lngResult As Long
str1 = strFile & vbNullChar
'is this code executed under WinNT?
If IsWinNT Then
'if we're in WinNT, we have to call the Unicode version of the function
lngResult = SHChangeIconDialogW(Me.hWnd, StrPtr(str1), lng1, lngIconNum)
Else
'if we're in Win9x, we have to call the ANSI version of the function
lngResult = SHChangeIconDialogA(Me.hWnd, str1, lng1, lngIconNum)
End If
'The function itself returns 0 (failed) or 1 (success)
'str1 is adapted to the selected filename
chooseIcon = (lngResult <> 0)
If chooseIcon Then
strFile = Left$(str1, InStr(1, str1, vbNullChar, vbBinaryCompare) - 1)
End If
InIcon=lngIconNum:Path=str1
End Function
Private Sub Form_Load()
chooseIcon "shell32.dll", 0
'для примера
print Inicon
print path
End Sub

Автор: efedron 13.4.2005, 13:00
не работает и все тут smile

Автор: Exception 14.4.2005, 17:52
Вообще-то для кода есть спец. теги.
А так - эта ф-ция не изменяет значения szFileName.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)