Jump to content

GUICtrlCreateIcon


Recommended Posts

I upgraded to the latest beta today, and all of the GUICtrlCreateIcon calls in my script display nothing now... Anyone else have this issue?

If this is an error, it belongs in Bug reports, but don't put it there unless you can give us some example code that reproduces the error.
Link to comment
Share on other sites

If this is an error, it belongs in Bug reports, but don't put it there unless you can give us some example code that reproduces the error.

It doesnt throw any errors, it just will not display the icon in the GUI. Here's the code:

Global $sRASUIDLL = @ScriptDir & "\RASUI.dll"
GUICtrlCreateIcon ($sRASUIDLL, 98, 10, 12, 30, 30)

The syntax hasnt changed from version to version, hence the reason I was wondering if someone else has these problems...

Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki
Link to comment
Share on other sites

It doesnt throw any errors, it just will not display the icon in the GUI. Here's the code:

Global $sRASUIDLL = @ScriptDir & "\RASUI.dll"
GUICtrlCreateIcon ($sRASUIDLL, 98, 10, 12, 30, 30)

The syntax hasnt changed from version to version, hence the reason I was wondering if someone else has these problems...

As Larry I don't have the rasui.dl either

but try GUICtrlCreateIcon ($sRASUIDLL, -98, 10, 12, 30, 30) or a minus number around it as it is the modification we did to have a good support of reference by number/name of the selectd icon.

Link to comment
Share on other sites

As Larry I don't have the rasui.dl either

but try GUICtrlCreateIcon ($sRASUIDLL, -98, 10, 12, 30, 30) or a minus number around it as it is the modification we did to have a good support of reference by number/name of the selectd icon.

I'll attach it when I get to the office... I did try your suggestion, and it displayed an icon, but the wrong one... The thing is, the call to that dll everywhere else in the script is working flawlessly, but CreateIcon is borked...

RASUI.dll

Edit: I see what adding the - did... and it's working now using -99 instead of 98... Any ideas what the problem is? Why wont it display properly, but all of the other calls to that particular icon work?

Edited by RagnaroktA
Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki
Link to comment
Share on other sites

  • 3 weeks later...

;)i've made the same experience with GUICtrlCreateIcon in v3.2.1.13

#include <GUIConstants.au3>

GUICreate("Icons in Shell32.dll",910,800)
$ExitBtn = GUICtrlCreateButton("",840,740,40,40, $BS_ICON)
GUICtrlSetImage(-1,"Shell32.dll",27)

$X = 20
$Y = 25
$Count = 0
For $i = 0 To 237
    $icon = GUICtrlCreateIcon("shell32.dll",$i, $X, $Y)
    $label = GUICtrlCreateLabel($i, $X+10, $Y+35,30,14)
    $X = $X + 40
    $Count = $Count + 1
    If $Count = 22 Then 
        $Count = 0
        $X = 25
        $Y = $Y + 67
    EndIf   
Next

GUISetState ()

While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE  Or $Msg = $ExitBtn Then ExitLoop
Wend

the code above executed with v 3.2.1.2 (and earlier) i get this result:

Posted Image

and with v3.2.1.13 i get this:

Posted Image

regards,

fuwi

Link to comment
Share on other sites

thanks Larry, but i'm a little bit confused now...

why must i set the IconID for GUICtrlSetImage to 27, and the IconID for GUICtrlCreateIcon to -28

for accessing the same shell32.dll-icon in both functions?

in the helpfile, the explanation for the IconID is identical for both functions.

furthermore, in the help for both functions i read:

"iconID can reference the icon group number. Use a resource hacker to know the value."

but accessing e.g. the the icon group number 8240 works only for GUICtrlCreateIcon

$ExitBtn = GUICtrlCreateButton("",200,50,40,40, $BS_ICON)

GUICtrlSetImage(-1,"Shell32.dll", 8240)

shows a blank button

fuwi

Link to comment
Share on other sites

  • 4 weeks later...

I've found this to be even more confusing with v3.2.2.0 and I had to make the following changes in my script:

For controls created with GUICtrlCreateIcon() use GUICtrlSetImage(($num + 1) * - 1) to change the icon

For controls created with GUICtrlCreateButton() use GUICtrlSetImage($num) to change the icon

So... GUICtrlSetImage() actually acts differently based on the control type (icon vs. button)

:P

I don't like it, but at least I understand what it's doing now.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...