13-May-11
This library contains only one function which displays a dialog box that allows the user to choose an icon from the selection available embedded in a resource such as an executable or DLL file. Of course, there is a PickIconDlg() API function but the dialog box created by this library has the following advantages:
- Ability to resize the displayed icons.
- Ability to resize the dialog box.
- Ability to save the window's settings (size, position, etc.) in the registry.
- Fully customizable appearance a dialog box.
- More pleasing appearance.
WM_COMMAND
WM_CONTEXTMENU
WM_GETMINMAXINFO
WM_NOTIFY
WM_SYSCOMMAND
If you use in your code one of these messages, you should call handlers from this library until returns from your handlers, otherwise, the dialog box will not work properly, for example:
As usualy, I will be glad to any feedback and suggestions.
![]()
IconChooser UDF Library v1.1
(Previous downloads: 71)
IconChooser.au3 38.44K
578 downloadsDescription
; #FUNCTION# ==================================================================================================================== ; Name...........: _IconChooserDialog ; Description....: Creates a "Change Icon" dialog box that enables the user to select an icon. ; Syntax.........: _IconChooserDialog ( [$sFile [, $iIndex [, $iSize [, $iFlags [, $hParent [, $sTitle]]]]]] ) ; Parameters.....: $sFile - The path of the file that contains the initial icon. ; $iIndex - The zero-based index of the initial icon. If this value is a negative number, will be initialized the ; icon whose resource identifier is equal to the absolute value of this value. ; $iSize - The size of the initial displaying icons. This parameter can be in the range from 8 to 256. ; $iFlags - The flags that defines a style of the dialog box. This parameter can be zero, (-1), ; or combination of the following values. ; ; $IC_FLAG_BROWSEFIlE ; $IC_FLAG_ICONSIZE ; $IC_FLAG_ICONLABEL (Not currently used) ; $IC_FLAG_RESIZABLEWINDOW ; $IC_FLAG_USEREGISTRY ; $IC_FLAG_USECACHE ; $IC_FLAG_EXPLORERSTYLE ; $IC_FLAG_DEFAULT ; ; $hParent - Handle to the window that owns the dialog box. ; $sTitle - Title of the dialog box. ; Return values..: Success - The array containing the following parameters: ; ; [0] - The path of the file that contains the selected icon. ; [1] - The index of the selected icon. ; ; Failure - 0. ; Author.........: Yashied ; Modified.......: ; Remarks........: If $IC_FLAG_USEREGISTRY flag is set, the dialog's settings (window size and position, file path, etc.) will be ; taken from the registry and saved in the registry after closing the window to the following hive: ; ; HKEY_CURRENT_USER\Software\Y's\Common Data\Icon Chooser\1.x ; ; If $IC_FLAG_USECACHE flag is set, the icons will be cached to improve display performance at the following ; shows. All cached icons are located in a temporary directory in the following format: ; ; %TEMP%\IC-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.cache ; ; The maximum cache size is 250 MB. ; Related........: ; Link...........: ; Example........: Yes ; ===============================================================================================================================
Example
#Include <IconChooser.au3> Global $Ico[2] = [@SystemDir & '\shell32.dll', 23] $hForm = GUICreate('MyGUI', 160, 160) $Button = GUICtrlCreateButton('Change Icon...', 25, 130, 110, 23) $Icon = GUICtrlCreateIcon($Ico[0], -(1 + $Ico[1]), 64, 50, 32, 32) GUISetState() While 1 Switch GUIGetMsg() Case -3 ExitLoop Case $Button $Data = _IconChooserDialog($Ico[0], $Ico[1], 32, -1, $hForm) If IsArray($Data) Then GUICtrlSetImage($Icon, $Data[0], -(1 + $Data[1])) $Ico = $Data EndIf EndSwitch WEnd
Edited by Yashied, 13 May 2011 - 08:57 PM.









