Sign in to follow this  
Followers 0
rudi

Basic question upon TraySetIcon()

3 posts in this topic

#1 ·  Posted (edited)

Hi.

For the func TraySetIcon() the helpfile is giving an example picking Icons from a DLL file. Is it also possible to use Icons from a compiled Autoit3 EXE file with Icon Files added, or from *.ICO files? If so, howto? I fail trying to do so ;)

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=C:\Icons\TLDCHECKOK.ico
#AutoIt3Wrapper_outfile=C:\AU3-EXE\TLDCheck.exe
#AutoIt3Wrapper_res_Icon_Add=C:\Icons\TLDCHECKERR.ico
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****



Opt("TrayAutoPause", 0)
Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown.
$exititem = TrayCreateItem("TLD Checker beenden.")
$LogfileOpen = TrayCreateItem("LOG File einsehen. (etwas Geduld!)")
TraySetState()
TraySetIcon(@ScriptFullPath, 1)


; ....

; with LiquidIcon.exe I can see, that the Icons *ARE* in the exe, Icon 1 and Icon 5
; The Tray Icon is always the Icon #1 in the EXE...

Func IconErr()
    TraySetIcon(@ScriptFullPath,5)
EndFunc

Func IconOK()
    TraySetIcon(@ScriptFullPath,1)
EndFunc

; ---------------------------------------------------------------------

; also when dropping the Icons with FileInstall, it doesn't work either.
; The Icons are in place, but the trayicon doesn't change:

FileInstall("C:\Icons\TLDCHECKERR.ico", @WindowsDir)
FileInstall("C:\Icons\TLDCHECKOK.ico", @WindowsDir)

Func IconUpdate($StatusOK) ; Status will be "True" or "False"
    If $StatusOK Then
        TraySetIcon(@WindowsDir & "\TLDCHECKOK.ICO")
    Else
        TraySetIcon(@WindowsDir & "\TLDCHECKERR.ICO")
    EndIf
EndFunc

Regards, Rudi.

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites



rudi

Use -5 in icon ID param.

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=C:\Icons\TLDCHECKOK.ico
#AutoIt3Wrapper_outfile=C:\AU3-EXE\TLDCheck.exe
#AutoIt3Wrapper_res_Icon_Add=C:\Icons\TLDCHECKERR.ico
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****

;Opt("TrayAutoPause", 0)
Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown.

$exititem = TrayCreateItem("TLD Checker beenden.")
$LogfileOpen = TrayCreateItem("LOG File einsehen. (etwas Geduld!)")

TraySetIcon(@ScriptFullPath, -3)

TraySetState()

MsgBox(0, "Info", "Set default icon")
TraySetIcon(@ScriptFullPath, 1)

MsgBox(0, "Info", 'Set a "TLDCHECKOK.ico"')
TraySetIcon(@ScriptFullPath, -5)

MsgBox(0, "Done", "Press OK to exit")

;)

Share this post


Link to post
Share on other sites

rudi

Use -5 in icon ID param.

Helpfile Code:

...
$num = -Random(0,100,1) ; MINUS!! Random ....
...

I've missed the negative in the help file!

Helpfile Text:

Passing a positive number will reference the string equivalent icon name.
Passing a negative number causes 1-based "index" behaviour. Some Dll can have icon extracted just with negative numbers.

Positive number: "... reference the string equivalent icon name" ;) What is a string equivalent of an Icon??

Thanks, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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