Jump to content
Sign in to follow this  
c.haslam

Where are common icons?

Recommended Posts

c.haslam

In which system .dll can I find the usual icons for FileNew, FileOpen, FileSave, Copy, Cut and Paste? I wish to create an ImageList.

(I first posted this to Example Scripts by mistake. Sorry.)

Edited by c.haslam

Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Share this post


Link to post
Share on other sites
monoscout999

User32.Dll look at GuiCtrlCreateIcon function example

Share this post


Link to post
Share on other sites
c.haslam

Thank you for replying.

Koda shows 6 icons in User32.dll, none of which is an icon I am looking for. Perhaps Koda's Imagelist Editor does not show all the icons. I am running XP SP3. Perhaps other versions of Windows have more icons in user32.dll.

None of the icons in the examples for GuiCtrlCreateIcon appears to be one of the icons I am looking for.

I am working on examples of Toolbar styles. I hope to create an Imagelist containing the icons listed.

Edited by c.haslam

Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Share this post


Link to post
Share on other sites
monoscout999

See the Help File you have the IconName Parameter, just change that number..

PD i have a mistake some icons are in Shell32.dll

GUICreate("Show Icons by monoscout999")
$IconsRow = Int(400 / 35)
$i = 0
$a = 0
$e = 0
While True
    GUICtrlCreateIcon("shell32.dll", $e, 35 * $i, $a)
    $e += 1
    $i += 1
    If $i = $IconsRow Then
        $i = 0
        $a += 35
    EndIf
    If $a > 35 * $IconsRow Then ExitLoop
WEnd
GUISetState()
Do
Until GUIGetMsg() = -3

Share this post


Link to post
Share on other sites
Zedna

Here is example with Toolbar containing standard New/Open/Save buttons also with apropriate standard icons

I think it should be possible to create imagelist with these standard system icons and use them where you want from imagelist.

MSDN:

Toolbar Standard Button Image Index Values

http://msdn.microsoft.com/en-us/library/bb760433%28v=vs.85%29.aspx

TB_ADDBUTTONS Message

http://msdn.microsoft.com/en-us/library/bb787291%28v=vs.85%29.aspx

Edited by Zedna

Share this post


Link to post
Share on other sites
Zedna

http://blogs.msdn.com/b/brada/archive/2006/06/06/618797.aspx

http://www.adrianbanks.co.uk/?p=18

Microsoft’s Brad Abrams and Somasegar both posted about a set of standard Microsoft icons that ship with Visual Studio 2005. They can be found in a zip file in the Visual Studio 2005 installation directory (usually C:\Program Files\Microsoft Visual Studio 8\Common7\VS2005ImageLibrary\VS2005ImageLibrary.zip). There are over 600 icons in total with a mixture of Windows, Office and Visual Studio icons, and are licenced for reuse in your own applications.

Share this post


Link to post
Share on other sites
GEOSoft

Take a look at _GUICtrlToolbar_AddBitmap() in the help file. If you look at the page Zedna gave you; you will see that there are even more constants you could add if you wanted to.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
c.haslam

I found it:

It's in C:\WINDOWS\system32\comctl32.dll

but not as ICO files but as one Bitmap resource containing all icons.

Open this DLL by reshacker and look at all Bitmap resources.

I have downloaded and run reshacker on comctrl32.dll. I have found the bmp resource. How do I export the icons in it to .ico files? Or is there a way of making an ImageList from the bmp resource directly? I find resHacker's help a bit intimidating.

See for why I am, at this point, not using internal imagelists.

Edited by c.haslam

Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Share this post


Link to post
Share on other sites
BrewManNH

I have downloaded and run reshacker on comctrl32.dll. I have found the bmp resource. How do I export the icons in it to .ico files? Or is there a way of making an ImageList from the bmp resource directly? I find resHacker's help a bit intimidating.

I use ICOFX to extract and manipulate icon files.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
c.haslam

I use ICOFX to extract and manipulate icon files.

I have downloaded, installed, and run IcoFX. I do not see how to:

  • Extract the icons from comctl32.dll (perhaps because IcoFX does not recognize a bmp resource as a container for icons)
  • Extract the icons from the bmp file.
Help would be appreciated.

Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Share this post


Link to post
Share on other sites
guinness

Or IconsExtract from NirSoft >> http://www.nirsoft.net/utils/iconsext.html


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
c.haslam

Take a look at _GUICtrlToolbar_AddBitmap() in the help file. If you look at the page Zedna gave you; you will see that there are even more constants you could add if you wanted to.

I am consulting this page on MSDN and many of the pages linked to it. My need for icons is limited: I need enough (e.g. 4) to demonstrate each of the styles and the combinations of styles. I realize that some cannot be combined. My script will limit the choices of combinations to those MSDN does not say can not be combined.

The constants I need to include, for the control itself, are:

Global Const $TBSTYLE_TOOLTIPS = 0x00000100 ; Creates a ToolTip control
Global Const $TBSTYLE_WRAPABLE = 0x00000200 ; Creates a toolbar that can have multiple lines of buttons
Global Const $TBSTYLE_ALTDRAG = 0x00000400 ; Allows users to change a toolbar button's position by dragging it
Global Const $TBSTYLE_FLAT = 0x00000800 ; Creates a flat toolbar
Global Const $TBSTYLE_LIST = 0x00001000 ; Creates a flat toolbar with button text to the right of the bitmap
Global Const $TBSTYLE_CUSTOMERASE = 0x00002000 ; Sends $NM_CUSTOMDRAW messages when processing $WM_ERASEBKGND messages
Global Const $TBSTYLE_REGISTERDROP = 0x00004000 ; Sends $TBN_GETOBJECT messages to request drop target objects
Global Const $TBSTYLE_TRANSPARENT = 0x00008000 ; Creates a transparent toolbar

plus exStyles

Global Const $TBSTYLE_EX_DRAWDDARROWS = 0x00000001 ; Allows buttons to have a separate dropdown arrow
Global Const $TBSTYLE_EX_MIXEDBUTTONS = 0x00000008 ; Allows mixing buttons with text and images
Global Const $TBSTYLE_EX_HIDECLIPPEDBUTTONS = 0x00000010 ; Hides partially clipped buttons
Global Const $TBSTYLE_EX_DOUBLEBUFFER = 0x00000080 ; Requires the toolbar to be double buffered

plus common styles

Global Const $CCS_TOP           = 0x01
Global Const $CCS_NOMOVEY       = 0x02
Global Const $CCS_BOTTOM        = 0x03
Global Const $CCS_NORESIZE      = 0x04
Global Const $CCS_NOPARENTALIGN = 0x08
Global Const $CCS_NOHILITE      = 0x10
Global Const $CCS_ADJUSTABLE    = 0x20
Global Const $CCS_NODIVIDER     = 0x40
Global Const $CCS_VERT          = 0x0080
Global Const $CCS_LEFT          = 0x0081
Global Const $CCS_NOMOVEX       = 0x0082
Global Const $CCS_RIGHT         = 0x0083

There are, to me, two possible approaches:

  • call _GuiCtrlToolbar_Create with styles and exStyles
  • call _GuiCtrlToolbar_Create with no styles and exStyles, and call _GuiCtrlToolbar_SetStyles and _GuiCtrlToolbar_SetExtendedStyles to set the styles and exStyles
I began with Approach 1. It didn't work as documented for $TBSTYLE_LIST. Wondering why, I read in About Toolbar Controls that "Applications that want to use the image list method must use the CreateWindowEx function to create the toolbar control". (_GuiCtrlToolbar_Create calls CreateWindowEx.) Because Koda must work for any icons, not just ones that have constants, and because MSDN sometimes tells half the story, I decided to try Approach 2. This is the approach used in the examples in the AutoIt help file. See the link in my reply to Zedna for more info.

Thanks for the help.


Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Share this post


Link to post
Share on other sites
c.haslam

Or IconsExtract from NirSoft >> http://www.nirsoft.net/utils/iconsext.html

I tried it. Didn't see the bmp resource.


Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Share this post


Link to post
Share on other sites
GEOSoft

I've never yet seen an icon extractor that would get the bitmap resources. Although I have managed to export the bitmaps and then use a graphics editor to get the individual icons but that is a hassle and the icons seldom turn out the way I want them.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
Zedna

Here is concept how to load this bitmap to imagelist and use icons from it.

It's only concept written without syntax chcking/testing!

$hInstance = _WinAPI_LoadLibraryEx(@SystemDir & "\comctl32.dll ", $LOAD_LIBRARY_AS_DATAFILE)
$hBitmap = _WinAPI_LoadImage($hInstance, 1, $IMAGE_BITMAP, 0, 0, 0) ; I'm not sure about image name/index in $sImage parameter
$hImageList = _GUIImageList_Create(24, 24)
_GUIImageList_Add($hImageList, $hBitmap, 0)

; now use this ImageList, something like this:
;_GUICtrlListView_SetImageList($listview, $hImageList, 0)
;_GUICtrlButton_SetImageList($button, $hImageList)

Share this post


Link to post
Share on other sites
c.haslam

This works:

#include <Constants.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>
#include <GuiToolbar.au3>


$hImageList = CreateImageList()
$Form3 = GUICreate("Form3", 623, 449, 192, 114)
GUISetBkColor(0xffff77)
$ToolBar1 = _GUICtrlToolbar_Create($Form3, $TBSTYLE_FLAT)
_GUICtrlToolbar_SetImageList($ToolBar1, $hImageList)
_GUICtrlToolbar_AddButton($ToolBar1, 0, 6, 0)
_GUICtrlToolbar_AddButton($ToolBar1, 0, 7, 0, $BTNS_DROPDOWN)
_GUICtrlToolbar_AddButton($ToolBar1, 0, 8, 0, $BTNS_CHECK)
GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()

Func CreateImageList()
    $hInstance = _WinAPI_LoadLibraryEx(@SystemDir& "\comctl32.dll ", $LOAD_LIBRARY_AS_DATAFILE)
    $hBitmap = _WinAPI_LoadImage($hInstance, 121, $IMAGE_BITMAP, 0, 0, 0)
    $hImageList = _GUIImageList_Create(24, 24)
    _GUIImageList_Add($hImageList, $hBitmap, 0)
    Local $vec[2]
    $vec = _GUIImageList_GetIconSize($hImageList)
    MsgBox(0,"Icon size",$vec[0]&" x "&$vec[1]&@CRLF&_GUIImageList_GetImageCount($hImageList)&" images")
    Return $hImageList
EndFunc

The 121 value for the parameter is based on resHacker: see attachment.

Thanks for the guidance

Edited by c.haslam

Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Share this post


Link to post
Share on other sites
Zedna

This works:

Just added all buttons in FOR/NEXT loop

#include <Constants.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>
#include <GuiToolbar.au3>


$hImageList = CreateImageList()
$Form3 = GUICreate("Form3", 623, 449, 192, 114)
GUISetBkColor(0xffff77)
$ToolBar1 = _GUICtrlToolbar_Create($Form3, $TBSTYLE_FLAT)
_GUICtrlToolbar_SetImageList($ToolBar1, $hImageList)

For $i = 0 To 14
    _GUICtrlToolbar_AddButton($ToolBar1, 0, $i, 0)
Next

;_GUICtrlToolbar_AddButton($ToolBar1, 0, 6, 0);
;_GUICtrlToolbar_AddButton($ToolBar1, 0, 7, 0, $BTNS_DROPDOWN)
;_GUICtrlToolbar_AddButton($ToolBar1, 0, 8, 0, $BTNS_CHECK)
GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()

Func CreateImageList()
    $hInstance = _WinAPI_LoadLibraryEx(@SystemDir& "\comctl32.dll ", $LOAD_LIBRARY_AS_DATAFILE)
    $hBitmap = _WinAPI_LoadImage($hInstance, 121, $IMAGE_BITMAP, 0, 0, 0)
    $hImageList = _GUIImageList_Create(24, 24)
    _GUIImageList_Add($hImageList, $hBitmap, 0)
    Local $vec[2]
    $vec = _GUIImageList_GetIconSize($hImageList)
    MsgBox(0,"Icon size",$vec[0]&" x "&$vec[1]&@CRLF&_GUIImageList_GetImageCount($hImageList)&" images")
    Return $hImageList
EndFunc
Edited by Zedna

Share this post


Link to post
Share on other sites
Zedna

To get nice transparent icons change this:

original:

$hBitmap = _WinAPI_LoadImage($hInstance, 121, $IMAGE_BITMAP, 0, 0, 0)

new:

$hBitmap = _WinAPI_LoadImage($hInstance, 121, $IMAGE_BITMAP, 0, 0, $LR_LOADMAP3DCOLORS)

EDIT: It's transparent only on default form's color, not on yellow one used in your example.

$LR_LOADTRANSPARENT doesn't work for me at all.

Edited by Zedna

Share this post


Link to post
Share on other sites
c.haslam

$LR_LOADTRANSPARENT doesn't work for me at all.

It doesn't work for me either. Having written styles dialog scripts for almost all the other controls Koda offers, I was hoping to finish them all, and suggest them to lazycat. I have to come to terms with the likelihood that Toolbar will take many weeks to figure out!

I think that the author of the UDFs did a fine job of providing access to Toolbar in AutoIt: he figured out the structures and pointers. The help for some UDFs (but not the Toolbar ones) says "This function is for Advanced users and for learning how the control works". It is unfortunate that functions that are hard to use have been made UDFs, blocking the way for easier-to-use versions. With RichEdit, I tried to make the UDFs as easy to use as possible, without sacrificing any functionality. I was able to build on some fine technical programming by excellent techies, which required more than just structures and pointers. It took me 3 months of spare time. See my other for the inconsistencies in Windows.

It's transparent only on default form's color, not on yellow one used in your example.

I am using the yellow form color so I can see whether the buttons are transparent. Does this make sense?


Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

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  

×