Sign in to follow this  
Followers 0
Tweaky

Icon-ID wrong

5 posts in this topic

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

#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

Share this post


Link to post
Share on other sites



$icon_id = $icon_split[2]+1

Fixed it.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Hi,

I think someone on the german forum has found a solution.

$icon_id = ($icon_id+1)*-1

So I think this works.

Thanks

Share this post


Link to post
Share on other sites

#5 ·  Posted (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:

#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 by Nahuel

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