Jump to content

GUI/Tray Menu with icons and colors


Recommended Posts

Thanks Holger, you are the best! :rolleyes:



Using OS: Win 7 Professional, Using AutoIt Ver(s): /

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...


AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *





AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

  • 3 weeks later...

Update 17.07.2007:

- now you can also use menu icons for the tray

- added commands for tray

For info: this is more a workaround which uses GUICtrlCreated menus/items together with the GUIRegisterMsg()

See 1st post...



Edited by Holger
Link to comment
Share on other sites

Any chance of a _GUICtrlODMenuItemSetState() to match the new _TrayIconSetState()? (I tried my best but your usage of DllStruct(..) is akin to magic for me at my current programming level)

Great updates that you are making on this library Holger, I really appreciate it. Especially the _GUICtrlODMenuItemSetText (that i even requested some months ago) is a lifesaver for me, thanks a lot for that one alone! :whistle:



Link to comment
Share on other sites

Ok, thanks for your quick reply, it was because I started out trying to use GUICtrlSetState to make a default (bold) text menu item..

Like so: GUICtrlSetState($mItem, $GUI_DEFBUTTON), this is working fine on standard menu items but not on your extended menu. I can make other states such as $GUI_DISABLE..etc. work just fine. Any chance of getting bold text on specific menu items with ModernMenuLib?

Just use GUICtrlSetState()



Edit: speleling fixed

Edited by Sunaj
Link to comment
Share on other sites

Update 21.07.2007

- added bold item support - with GUICtrlSetState($item, $GUI_DEFBUTTON)

-> limited to menuitems only, menus are not supported!

Edited by Holger
Link to comment
Share on other sites

Hi? This is a really good script.

Now, I am studying on it and it works great!!

I have one question.

_TrayTip($nTrayIcon1,"Information", "Now, new tray icon available ", 1,$NIIF_INFO)

in this script, the Tray balloon tip last too long.

How can I reduce the time of balloon tip up?

Your help would be very appreciated.

Edited by kjason
Link to comment
Share on other sites

@Sleepy: with the 'TrayClick' I will take a look how to make it work.

The "I get an error when i try to work the tray with icons" you should explain a little bit more...with thisone I don't understand what your problem is.

@kjason: from MSDN:

"The system minimum and maximum timeout values are currently set at 10 seconds and 30 seconds, respectively"

So, if you set a timeout of 5sec it will be changed by system to 10 and i.e. if you use 40sec it will be changed to 30.

Greets :)


Link to comment
Share on other sites

hi holger nice work

but when i compile the sample


everything looks nie

but when i compile the "non unicode" version (sampleGUIandTray.au3), where i see no difference in code - i get an error which i dont understand

H:\autoit\menu lib - tray menu\ModernMenu.au3(449,33) : ERROR: LoadIcon(): undefined function.

$hIcon = LoadIcon(0, $nIconID)


H:\autoit\menu lib - tray menu\sampleGUIandTray.au3 - 1 error(s), 0 warning(s)

mfg nob

Link to comment
Share on other sites


- Fixed: missing LoadIcon()

Thank you both for info (Sleepy and nobbe).

If you don't want to download it again just add the following code at the end of the "ModernMenu.au3":

Func LoadIcon($hInstance, $nIcon)
    Local $hIcon = DllCall("user32.dll", "hwnd", "LoadIcon", _
                                                "hwnd", $hInstance, _
                                                "int", $nIcon)
    Return $hIcon[0]

This was a merging error (the merging of my old ModernMenu with the TrayMenu).



Link to comment
Share on other sites

hi holger

great job!

i have already used it in my new program

one thing that i try to figure out is:

when setting an icon resource from shell32.dll

$AboutItem = _GUICtrlCreateODMenuItem ("About...", $HelpMenu, "shell32.dll", 23) ; --> 24-1 in reshacker icon group

the icon index doesnt correspond to the function

$icon = GUICtrlCreateIcon ("shell32.dll", 23, 20,20)

which now displays a different icon resource

the only thing i could figure out is with "reshacker " i go to icon groups and now the icon resource on the above would be iconindex-1

do you think there is a way to syncronize with the "GUICtrlCreateIcon " function to figure out the icons more quickly?

mfg nobbe

Link to comment
Share on other sites

i now get this error:

ModernMenu.au3(1556,174) : ERROR: CreateFont() called by a previous line with 1 arg(s). Min = 14. First previous line calling this Func is 1433.

Func CreateFont($nHeight, $nWidth, $nEscape, $nOrientn, $fnWeight, $bItalic, $bUnderline, $bStrikeout, $nCharset, $nOutputPrec, $nClipPrec, $nQuality, $nPitch, $ptrFontName)


How do you make it so when you click the tray icon, it executes a function, not opens a menu.

Edited by SleepyXtreme
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

  • Recently Browsing   0 members

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