Sign in to follow this  
Followers 0

IconChooser UDF

8 posts in this topic

Posted (edited)

LAST VERSION - 1.1

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.

IMPORTANT This library registers the following Windows Message (WM):

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:

Func MY_WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
	Local $Result = IC_WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
	If $Result <> $GUI_RUNDEFMSG Then
		Return $Result
	EndIf

	...

EndFunc

As usualy, I will be glad to any feedback and suggestions.

 

IconChooser.png

IconChooser UDF Library v1.1

Previous downloads: 71

IconChooser.au3

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

Share this post


Link to post
Share on other sites



Posted

Interesting, but FYI there seems to be lots of problems on x64.

The relosution dropdown, and the gui's icon isn't replaced. Probably more, but I don't have time to go over it all now, was just on my way out.

Question: If your main OS isn't x64, then why don't you install a vm so you can test stuff yourself instead of rely on my sleep-deprived reports? :unsure:

(I like VMware Workstation)

Share this post


Link to post
Share on other sites

Posted

Very nice, it will help me in choosing an icon for programs I create. Previously I'd just loop through them until I saw one I liked. Now I can pick one out a LOT easier. :unsure:

Share this post


Link to post
Share on other sites

Posted

Interesting, but FYI there seems to be lots of problems on x64.

It's the same problem as

$tagNMITEMACTIVATE = $tagNMHDR & ';uint Aligment;int Index;int SubItem;uint NewState;uint OldState;uint Changed;int X;int Y;lparam lParam;uint KeyFlags'

Fixed.

Share this post


Link to post
Share on other sites

Posted

Wonderful!!!Much better than the native function in Windows...

Share this post


Link to post
Share on other sites

Posted

The library has been updated to version 1.1.

Changes

  • Added icon cache (speeds up the display a few times), use $IC_FLAG_USECACHE flag. All cached icons are located in a temporary directory in the following format:

    %TEMP%\IC-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.cache

  • Improved logic save the window's parameters to the registry.
  • Improved alignment of the dialog window to the parent window in Windows Vista+.
  • Added a hotkey F5 to refresh the icons.
  • Fixed minor bugs in the code.

Share this post


Link to post
Share on other sites

Posted

I know this is a bit old post, but wanted to drop in my thanks for creating this.

We are working on a project that this will fit in very nicely and wanted to express my appreciation for the skill shown here.

Very amazing work, Yashied!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.