Sign in to follow this  
Followers 0
Blinko

Different icon displayed for Button and Icon Gui but have same postion within shell32.dll

4 posts in this topic

Why are the icons different for the two GUI controls. Thanks for your help.

#include <GUIConstants.au3>

$iconfile="C:\WINDOWS\system32\SHELL32.dll"

$iconnum=220

$Form1 = GUICreate("AForm1", 183, 224, 533, 411)

$Label1 = GUICtrlCreateLabel("Button GUI icon",10,24,100,20)

$Button1 = GUICtrlCreateButton("", 152, 24, 20, 20, $BS_ICON)

GUICtrlSetImage (-1,$iconfile,$iconnum,0)

$Label1 = GUICtrlCreateLabel("Icon GUI",10,50,100,20)

$ICON1 = GUICtrlCreateIcon($iconfile, $iconnum, 152, 50, 20, 20, BitOR($SS_NOTIFY,$WS_GROUP))

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

Share this post


Link to post
Share on other sites



There is a difference of 1 in the icon numbers that are used depending on whether the control updated by GuiCtrlSetData is a button or an image by the looks of it. I don't know why but the code below illustrates the problem.

#include <GUIConstants.au3>

$iconfile="D:\WINDOWS\system32\SHELL32.dll"
$iconnum=2

$Form1 = GUICreate("AForm1", 183, 224, 533, 411)
$Label1 = GUICtrlCreateLabel("Button GUI icon",10,24,100,20)

$Label1 = GUICtrlCreateLabel("Icon GUI",10,50,100,20)
$ICON1 = GUICtrlCreateIcon($iconfile, $iconnum , 152, 50, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP));
$Button1 = GUICtrlCreateButton("", 152, 24, 32,32, $BS_ICON)

GUISetState(@SW_SHOW)


$n = $iconnum-1

$startt = timerinit()
While 1
if TimerDiff($startt) >= 500 Then
    $startt = timerinit()
    $n += 1
    GUICtrlSetData($Label1,$n)
    GUICtrlSetImage ($button1,$iconfile,$n-1,0);<------why -1? I don't know, maybe it's a bug.
    Guictrlsetimage($ICON1,$iconfile,$n,0);
    sleep(2)
EndIf

$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $Button1
        MsgBox(0,'number is',$n)


EndSwitch
WEnd

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

History, raddishes and Autoit forums!

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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