Tweaky Posted October 29, 2007 Share Posted October 29, 2007 Hi, I have a problem. I have postet it on the german autoit forum, but nobody has a solution I want to display Icons. I read the icon-name and icon-id out from the regedit But autoit has another id as in the regedit of windows At windows the first icon from shell32.dll is called "0" The following icons have 1, 2, 3 and so. At autoit the ID is not in a row How can i display the right icon??? Thanks Here an example. I should be the icon with the cd displayed expandcollapse popup#include <GUIConstants.au3> #include <Array.au3> $GUI = GUICreate("Test", 1000, 980, -1, -1) $beenden = GuiCtrlCreateButton ("beenden", 820, 70, 50, 50, $BS_ICON) GUICtrlCreateLabel(" beenden", 817, 40, -1, -1, BitOR($WS_BORDER, $SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xB0E0E6) GUICtrlSetImage ($beenden, "shell32.dll", 28) $reg = "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AudioCD\DefaultIcon" $reg_hinten = "" $icon_reg = RegRead($reg, $reg_hinten) $icon = GUICtrlCreateIcon("", 0, 50, 50, 50, 50, BitOR($SS_NOTIFY,$WS_GROUP)) If StringInStr($icon_reg, ",") Then $icon_split = StringSplit($icon_reg, ",") $icon_name = $icon_split[1] $icon_id = $icon_split[2] Else $icon_name = $icon_reg $icon_id = "" EndIf MsgBox(0,"",$icon_name & "|" & $icon_id & "|", 2) GUICtrlSetImage($Icon, $icon_name, $icon_id) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $beenden Exit Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Link to comment Share on other sites More sharing options...
Nahuel Posted October 29, 2007 Share Posted October 29, 2007 $icon_id = $icon_split[2]+1 Fixed it. Link to comment Share on other sites More sharing options...
Tweaky Posted October 29, 2007 Author Share Posted October 29, 2007 Hi, thanks for the fast reply. Are you sure??? Because for example the ie icon has the id 220 or 512. And this is not only 1 number different Link to comment Share on other sites More sharing options...
Tweaky Posted October 29, 2007 Author Share Posted October 29, 2007 Hi, I think someone on the german forum has found a solution. $icon_id = ($icon_id+1)*-1 So I think this works. Thanks Link to comment Share on other sites More sharing options...
Nahuel Posted October 29, 2007 Share Posted October 29, 2007 (edited) I really don't know why that happens... Go to Program Files\AutoIt3\Examples\GUI\Advanced and open enumicons.au3. Maybe it will help you, I don't know. Notice that you can use the name or the ordinal value... maybe doing $id*(-1) ? -edit- boo, you beat me Also, is it just me or there's a lot of quality loss using that method? I wonder why.. look: expandcollapse popup#include <GUIConstants.au3> #include <Array.au3> $GUI = GUICreate("Test", 500, 500, -1, -1) $beenden = GuiCtrlCreateButton ("beenden", 820, 70, 50, 50, $BS_ICON) GUICtrlCreateLabel(" beenden", 817, 40, -1, -1, BitOR($WS_BORDER, $SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xB0E0E6) GUICtrlSetImage ($beenden, "shell32.dll", 28) $reg = "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AudioCD\DefaultIcon" $reg_hinten = "" $icon_reg = RegRead($reg, $reg_hinten) $icon = GUICtrlCreateIcon("", 0, 50, 50, 50, 50, BitOR($SS_NOTIFY,$WS_GROUP)) If StringInStr($icon_reg, ",") Then $icon_split = StringSplit($icon_reg, ",") $icon_name = $icon_split[1] $icon_id = $icon_split[2] Else $icon_name = $icon_reg $icon_id = "" EndIf $icon_id1 = ($icon_id+1)*-1 GUISetState(@SW_SHOW) GUICtrlSetImage($Icon, $icon_name, $icon_id1) Sleep(2000) GUICtrlSetImage($Icon, $icon_name, $icon_id+1) While 1 $msg = GUIGetMsg() Select Case $msg = $beenden Exit Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Edited October 29, 2007 by Nahuel Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now