shEiD 0 Posted April 27, 2010 Is it possible to make buttons with icons from simple .ico files? I've tried it, and it does not work? The example in "Help" uses shell32.dll and it works, but why it does not work with .ico, or .icl files? I've tried with a single image .ico files, multi image .ico files, .icl and I even tried making a .dll file with GConvert5 soft, it didn't work either. wth? #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $msg GUICreate("My GUI") ; will create a dialog box that when displayed is centered GUICtrlCreateButton("my picture button", 10, 20, 40, 40, $BS_ICON) ; GUICtrlSetImage(-1, "shell32.dll", 22) ; <- WORKS ; GUICtrlSetImage(-1, @ScriptDir & '\feed.ico') ; <- DOES NOT WORK !?!?! ; GUICtrlSetImage(-1, @ScriptDir & '\feed.ico', 1) ; <- DOES NOT WORK !?!?! GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>Example Does GUICtrlSetImage supports only shell32.dll? Share this post Link to post Share on other sites
Yashied 241 Posted April 27, 2010 Works fine for me. Maybe a problem with the icon? My UDFs:iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL HelperAnimated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF LibraryAppropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignmentMore... Share this post Link to post Share on other sites
Makaule 0 Posted April 27, 2010 (edited) It may sound strange, but where you got your *.ico file? I hope you didnt rename simple image to icon, for example from Test.bmp to Test.ico. I have tested and all works fine, just you should declare image width and height, in case it would be bigger then buttom, it could be resized. Edited April 27, 2010 by Makaule Share this post Link to post Share on other sites
shEiD 0 Posted April 27, 2010 Works fine for me. Maybe a problem with the icon?Huh... What can be wrong with the icon? Like I said, I've tried numerous (probably > 50) icons in various formats. The only thing that works is shell32.dll. I'm baffled.Could you, please, provide me with a working sample, icon? Share this post Link to post Share on other sites
shEiD 0 Posted April 27, 2010 (edited) It may sound strange, but where you got your *.ico file? I hope you didnt rename simple image to icon, for example from *.bmp to *.ico.Off course not Some are extracted from exe, etc, some are from the internet. "Proper" .ico files, if I could say so.e.g. this icon: link I tried this one as it comes, with 5 sizes inside, and even edited the icon with IcoFX, deleted 4 sizes, left only 48x48 - didn't work either way. Edited April 27, 2010 by shEiD Share this post Link to post Share on other sites
Makaule 0 Posted April 27, 2010 Just for test, could you try download any *.ico from http://www.iconarchive.com/ ? I would also check is your *.au3 file in corect place (same folder with *.ico). Which version of AutoIt are you using? Maybe its some kind of "glitch" of older version? Share this post Link to post Share on other sites
Yashied 241 Posted April 27, 2010 GUICtrlSetImage(-1, "C:\Program Files\AutoIt3\Icons\au3.ico") Works? My UDFs:iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL HelperAnimated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF LibraryAppropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignmentMore... Share this post Link to post Share on other sites
enaiman 16 Posted April 27, 2010 Works for me too. Here is an icon if that's what you want: Save.ico SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example scriptwannabe "Unbeatable" Tic-Tac-ToePaper-Scissor-Rock ... try to beat it anyway :) Share this post Link to post Share on other sites
shEiD 0 Posted April 27, 2010 Just for test, could you try download any *.ico from http://www.iconarchive.com/ ? I would also check is your *.au3 file in corect place (same folder with *.ico). Which version of AutoIt are you using? Maybe its some kind of "glitch" of older version?Tried an icon fro your link - no go. Tried putting icons in the same folder - no go. Tried providing full path to file, partial, either way - no go. I'm actually out of ideas what else to try, by this time.Runing autoit 3.3.6.0 ( not beta)Windows 7 Ultimate. Share this post Link to post Share on other sites
shEiD 0 Posted April 27, 2010 GUICtrlSetImage(-1, "C:\Program Files\AutoIt3\Icons\au3.ico") Works? WORKS! whatthehell? How that "C:\Program Files\AutoIt3\Icons\au3.ico" is different from any other .ico files? Share this post Link to post Share on other sites
shEiD 0 Posted April 27, 2010 (edited) Works for me too. Here is an icon if that's what you want: Save.ico And this icon does not work. /me bangs his head onto the wall... Honestly, I'm going crazy here. How come, one single icon ("C:\Program Files\AutoIt3\Icons\au3.ico") works, and ANYTHING else doesn't? This is a really bad joke Edited April 27, 2010 by shEiD Share this post Link to post Share on other sites
Makaule 0 Posted April 27, 2010 Well i will atach Test.au3 with *.ico, test it. It would use 2 ways of adding ico to buttom. Test it.TestButton.rar Share this post Link to post Share on other sites
shEiD 0 Posted April 27, 2010 Well i will atach Test.au3 with *.ico, test it. It would use 2 ways of adding ico to buttom. Test it.First of all, Thank You.I am going slightly crazy... I tried your example and it worked. Further more, my scripts started showing icons on buttons too. I have no f***in idea whats happening...(apologies). I was trying to do this for 2 hours probably before posting here. Then what, an hour till your post with an example. I just went through all my peaces of code, where I did tests, and, as it seems, the paths to the files are/were correct, (well, that's the only logical explanation, why would it not work before, and it does now...), so - I am out of ideas and words, what just happened.I will go thoroughly through all the code peaces again, after some 2-3 cigarettes, just to make sure, I'm not going mental... Anyway, thank you again. Share this post Link to post Share on other sites
GEOSoft 67 Posted April 27, 2010 I used to have the odd script fail for no apparent reason and after a system restart they would be fine. I just put it down to the Windows File Cache and ignored it after that. GeorgeQuestion 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
shEiD 0 Posted April 27, 2010 (edited) I used to have the odd script fail for no apparent reason and after a system restart they would be fine. I just put it down to the Windows File Cache and ignored it after that. I just reinstalled my windows, twice, actually. But, take a a look at this: GUICtrlCreateIcon(@ScriptDir & "\feed-icon-orange.ico", -3, 100, 0, 48, 48) I repeatedly ran same script from scite 20 times in a row: 13 times from 20, icon was displayed properly (with transparency), 7 times from 20, it was without transparency. A simple copy of the same script and icon: 20 times from 20 it displays icon incorrectly - without transparency. Now this, sucks... I would go crazy for hours and hours, scouring help file and forums, how to enable transparency. Does this kind of stuff can be Windows File Cache fault as well? Edit. Well, I tried to change up the styles, and it seems the culprit was $WS_VISIBLE in gui styles. But anyway, how come, sometimes it was displaying icons properly and sometimes - no? Edited April 27, 2010 by shEiD Share this post Link to post Share on other sites
trancexx 1,013 Posted April 27, 2010 Are you familiar with Occam's razor? What's your system (emphasizing bitness)? ♡♡♡ . eMyvnE Share this post Link to post Share on other sites
shEiD 0 Posted April 27, 2010 Are you familiar with Occam's razor? What's your system (emphasizing bitness)? Specs: OS: MS Windows 7 Ultimate 32-bit CPU: Intel Core i7 860 @ 2.80GHz 27 °C Lynnfield 45nm Technology MB: Gigabyte GA-P55M-UD2 RAM: G-Skill 4.0GB Dual-Channel DDR3 @ 666MHz 9-9-9-24 GPU: Westinghouse LVM-37w3se @ 1920x1080 BFG 640MB GeForce 8800 GTS (nVidia) 55 °C HDD: 80GB INTEL SSDSA2M080G2GC 500GB SAMSUNG SAMSUNG HD501LJ 28 °C 1500GB Seagate ST31500341AS 35 °C 2000GB Western Digital WDC WD20EADS-00R6B0 33 °C Opt: No optical disk drives detected Audio: Realtek High Definition Audio Share this post Link to post Share on other sites
trancexx 1,013 Posted April 27, 2010 Make a new folder. Add exact same script you run (that fails) and icon file to it. Compress and upload. Attach. ♡♡♡ . eMyvnE Share this post Link to post Share on other sites
shEiD 0 Posted April 27, 2010 Make a new folder. Add exact same script you run (that fails) and icon file to it. Compress and upload. Attach.Here is the script and icons. Now at start, icons always displayed without transparency. Only after you click mail icon, the toolbar repaints the icons properly, with transparency.gui.rar Share this post Link to post Share on other sites
trancexx 1,013 Posted April 27, 2010 Remove $WS_VISIBLE style from the GUI. ♡♡♡ . eMyvnE Share this post Link to post Share on other sites