Jump to content
Sign in to follow this  

guictrlcreaticon with a .ico file

Recommended Posts


Did a quick search but didn't find what I was looking for...seems basic enough to me.

I'm trying to create a icon in my GUI window and I am getting back a blank box sans the ico file I indicated.

The help file examples don't show a way to use a .ico file without having to use a iconName (typically for dll's, icl's, etc.) This is a stand alone ico file

What needs to be done to display a stand alone .ico image?


P.S: Haven't seen it yet but will the icon object respect the icon's transparent properties?

P.S.S.: It might be helpful to update the AutoIT help file to include a list of supported file types for icon and picture objects...currently the supported types are not listed in the GUICTRLCREATEICON or GUICTRLCREATEPIC sections nor are there links to a section in the help file that does cover this.

Here's an example snippet:

#Include <Constants.au3>
#include <GUIConstants.au3>
$iGUIWidth = 756
$iGUIHeight = 1024
$iGUILeft = (@DesktopWidth/2) - ($iGUIWidth/2)
$iGUITop = (@DesktopHeight/2) - ($iGUIHeight/2)
$sBackground = "<any .jpg file here>"
$sIcon = "<any .ico file here>"
$iGUI = GuiCreate("MyGUI",$iGUIWidth,$iGUIHeight,$iGUILeft,$iGUITop,$WS_POPUP,$WS_EX_TOOLWINDOW)
$iBackground = GUICtrlCreatePic($sBackground,0,0,$iGUIWidth,$iGUIHeight)
$iIcon = GUICtrlCreateIcon($sIcon,-1,20,20,64,64)
GUISetState(@SW_SHOW, $iGUI)

For me, I'm getting a grey square in the upper left hand corner...this should be the icon image.

Edited by sshrum

Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'


Share this post

Link to post
Share on other sites

I believe you need to have the correct type of icon. I am pretty certain size matters...16x16, 32x32 and 48x48 are acceptable. There's something about color too.

Edited by mikehunt114

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.