Jump to content
Sign in to follow this  
PlayHD

Tray Item Icon

Recommended Posts

PlayHD

I already try it with this but i got some errors ...

C:\Users\PlayHD\Desktop\useles\neterminate\desktop_loc\ModernMenuRaw.au3(122,81) : ERROR: $IDI_APPLICATION previously declared as a 'Const'.
If Not IsDeclared("IDI_APPLICATION")  Then Global Const $IDI_APPLICATION = 32512
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\PlayHD\Desktop\useles\neterminate\desktop_loc\ModernMenuRaw.au3(123,69) : ERROR: $IDI_HAND previously declared as a 'Const'.
If Not IsDeclared("IDI_HAND")    Then Global Const $IDI_HAND = 32513
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\PlayHD\Desktop\useles\neterminate\desktop_loc\ModernMenuRaw.au3(124,76) : ERROR: $IDI_QUESTION previously declared as a 'Const'.
If Not IsDeclared("IDI_QUESTION")   Then Global Const $IDI_QUESTION = 32514
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\PlayHD\Desktop\useles\neterminate\desktop_loc\ModernMenuRaw.au3(125,81) : ERROR: $IDI_EXCLAMATION previously declared as a 'Const'.
If Not IsDeclared("IDI_EXCLAMATION")  Then Global Const $IDI_EXCLAMATION = 32515
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\PlayHD\Desktop\useles\neterminate\desktop_loc\ModernMenuRaw.au3(126,76) : ERROR: $IDI_ASTERISK previously declared as a 'Const'.
If Not IsDeclared("IDI_ASTERISK")   Then Global Const $IDI_ASTERISK = 32516
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\PlayHD\Desktop\useles\neterminate\desktop_loc\ModernMenuRaw.au3(127,74) : ERROR: $IDI_WINLOGO previously declared as a 'Const'.
If Not IsDeclared("IDI_WINLOGO")   Then Global Const $IDI_WINLOGO = 32517
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\PlayHD\Desktop\useles\neterminate\desktop_loc\ModernMenuRaw.au3(133,77) : ERROR: $WM_MOUSEMOVE previously declared as a 'Const'.
If Not IsDeclared("WM_MOUSEMOVE")   Then Global Const $WM_MOUSEMOVE = 0x0200
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\PlayHD\Desktop\useles\neterminate\desktop_loc\ModernMenuRaw.au3(134,81) : ERROR: $WM_LBUTTONDOWN previously declared as a 'Const'.
If Not IsDeclared("WM_LBUTTONDOWN")   Then Global Const $WM_LBUTTONDOWN = 0x0201
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\PlayHD\Desktop\useles\neterminate\desktop_loc\ModernMenuRaw.au3(135,77) : ERROR: $WM_LBUTTONUP previously declared as a 'Const'.
If Not IsDeclared("WM_LBUTTONUP")   Then Global Const $WM_LBUTTONUP = 0x0202
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\PlayHD\Desktop\useles\neterminate\desktop_loc\ModernMenuRaw.au3(136,84) : ERROR: $WM_LBUTTONDBLCLK previously declared as a 'Const'.
If Not IsDeclared("WM_LBUTTONDBLCLK")  Then Global Const $WM_LBUTTONDBLCLK = 0x0203
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\PlayHD\Desktop\useles\neterminate\desktop_loc\ModernMenuRaw.au3(137,81) : ERROR: $WM_RBUTTONDOWN previously declared as a 'Const'.
If Not IsDeclared("WM_RBUTTONDOWN")   Then Global Const $WM_RBUTTONDOWN = 0x0204
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\PlayHD\Desktop\useles\neterminate\desktop_loc\ModernMenuRaw.au3(138,77) : ERROR: $WM_RBUTTONUP previously declared as a 'Const'.
If Not IsDeclared("WM_RBUTTONUP")   Then Global Const $WM_RBUTTONUP = 0x0205
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\PlayHD\Desktop\useles\neterminate\desktop_loc\ModernMenuRaw.au3(139,84) : ERROR: $WM_RBUTTONDBLCLK previously declared as a 'Const'.
If Not IsDeclared("WM_RBUTTONDBLCLK")  Then Global Const $WM_RBUTTONDBLCLK = 0x0206
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\PlayHD\Desktop\useles\neterminate\desktop_loc\ModernMenuRaw.au3(140,81) : ERROR: $WM_MBUTTONDOWN previously declared as a 'Const'.
If Not IsDeclared("WM_MBUTTONDOWN")   Then Global Const $WM_MBUTTONDOWN = 0x0207
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\PlayHD\Desktop\useles\neterminate\desktop_loc\ModernMenuRaw.au3(141,77) : ERROR: $WM_MBUTTONUP previously declared as a 'Const'.
If Not IsDeclared("WM_MBUTTONUP")   Then Global Const $WM_MBUTTONUP = 0x0208
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\PlayHD\Desktop\useles\neterminate\desktop_loc\ModernMenuRaw.au3(142,84) : ERROR: $WM_MBUTTONDBLCLK previously declared as a 'Const'.
If Not IsDeclared("WM_MBUTTONDBLCLK")  Then Global Const $WM_MBUTTONDBLCLK = 0x0209
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

$nTrayIcon1  = _TrayIconCreate("DL", "shell32.dll", -13)
_TrayIconSetClick(-1, 16)
_TrayIconSetState()
$nTrayMenu1  = _TrayCreateContextMenu()
Global $tray_hide = _TrayCreateItem("Hide")
_TrayItemSetIcon(-1,"ico\lock.ico")
Global $tray_setting = _TrayCreateItem("Settings")
_TrayItemSetIcon(-1,"ico\set.ico")
_TrayCreateItem("")
Global $tray_exit = _TrayCreateItem("Exit")
_TrayItemSetIcon(-1,"ico\x.ico")

if need i post all script...

Share this post


Link to post
Share on other sites
Emiel Wieldraaijer

Modernmenuraw.au3 was made for old versions of AutoIt and thats why you are getting the errors

simple search for the declared variable in Modernmenuraw.au3 which is causing the error and place a ; before it

Example -> $IDI_APPLICATION change into ;$IDI_APPLICATION

This will solve your problem.

Tip 1 -> Please remember to kill the tray when exiting the program

Tip 2 -> Create the tray icon before creating the GUI

Tip 3 -> This tray uses the GUI command instead of Tray commands

$nTrayIcon1 = _TrayIconCreate("Title", @ScriptName, 0)
_TrayIconSetState() ; Show the tray icon
$nTrayMenu1 = _TrayCreateContextMenu() ;This one must exist
$Tray1 = _TrayCreateItem("Tray1)
_TrayItemSetIcon(-1, @ScriptName, -1)
$Tray2 = _TrayCreateItem("Tray2")
_TrayItemSetIcon(-1, @ScriptName, -2)


Func _Terminate ()
    _TrayIconDelete($nTrayIcon1) ; First trayicon
    OnAutoItExit() ; Second trayicon
    Exit
EndFunc
Edited by Emiel Wieldraaijer

Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites
PlayHD

thanks Emiel... but i still have a problem

autoit icon remain

i already try it with

#NoTrayIcon

or

Opt("TrayIconHide",1)

Problem solved i forgot TraySetState() :bye:

Thanks again all :oops: ...

Edited by PlayHD

Share this post


Link to post
Share on other sites
Emiel Wieldraaijer

glad i could help


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites
Yashied
Emiel Wieldraaijer

If you are using Windows Vista+, you can use _WinAPI_Create32BitHBITMAP() from See example for this function.

Yes ... WinAPIEX UDF a master piece.. :oops:


Best regards,Emiel Wieldraaijer

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  

×