Yashied Posted January 5, 2011 Posted January 5, 2011 (edited) Note that icons will only work in Windows Vista and later. Also need a >WinAPIEx UDF library. Menu.ini[Menu] Open=File>Open Save=File>Save SaveAs=File>Save As... Copy=Edit>Copy Paste=Edit>Paste Separator=* Skin=Preferences>Interface>Skin Size=Preferences>Interface>Size Color=Preferences>Interface>Color Separator=Preferences>Interface>* Expert=Preferences>Interface>Advanced... Miscellaneous=Preferences>Miscellaneous... Separator=* Exit=Exit [Icon] Open=shell32.dll,45 Save=shell32.dll,258 SaveAs=shell32.dll,68 Copy=shell32.dll,134 Paste=shell32.dll,260 Skin=shell32.dll,303 Size=shell32.dll,240 Color=mspaint.exe,0 Expert=shell32.dll,300 Miscellaneous=shell32.dll,21 Exit=shell32.dll,131Menu.7zPrevious downloads: 617Menu.7z Edited December 22, 2013 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
guinness Posted January 5, 2011 Posted January 5, 2011 Wow! You never cease to amaze me. This is going in the Function Folder. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
guinness Posted January 21, 2011 Posted January 21, 2011 (edited) So I was quite inspired by your TrayMenu with Icons from ico/exe files that I decided to have a go at creating a Function that could convert an Image File and then display in the TrayMenu. This is how I came about creating _GUICtrlMenu_SetItemImage() using the Forum as a basis to learn. Note: I used this post >> from UEZ as a basis for creating the Function!Of course I know it can be improved, especially tidying up the resources, but for now it works!expandcollapse popup#include <GDIPlus.au3> #include <GUIMenu.au3> Opt('TrayMenuMode', 3) _GDIPlus_Startup() Example() Func Example() Local $hGUI = GUICreate('') Local $iSettingsItem = TrayCreateMenu('Settings') _GUICtrlMenu_SetItemBmp(TrayItemGetHandle(0), 0, _WinAPI_CreateSolidBitmap($hGUI, 0xFF00FF, 15, 15)) ; Set Image to Settings. Local $iDisplayItem = TrayCreateItem('Display', $iSettingsItem) Local $hImage_1 = _GUICtrlMenu_SetItemImage(@ScriptDir & 'Example.png', 0, $iSettingsItem) ; Set Image to Sub-Menu in Settings under Display. TrayCreateItem('Printer', $iSettingsItem) Local $hImage_2 = _GUICtrlMenu_SetItemImage(@ScriptDir & 'Example.png', 1, $iSettingsItem) ; Set Image to Sub-Menu in Settings under Printer. TrayCreateItem('Delete') Local $hImage_3 = _GUICtrlMenu_SetItemImage(@ScriptDir & 'Example.png', 1) ; Set Image to Delete. TrayCreateItem('') TrayCreateItem('About') TrayCreateItem('') Local $iExitItem = TrayCreateItem('Exit') TraySetState() While 1 Switch TrayGetMsg() Case $iExitItem ExitLoop Case $iDisplayItem MsgBox(0, 'Display/About', 'Display Or About Was Clicked!') EndSwitch Sleep(10) WEnd _WinAPI_DeleteObject($hImage_1) ; <<<< Delete Icon Image. _WinAPI_DeleteObject($hImage_2) ; <<<< Delete Icon Image. _WinAPI_DeleteObject($hImage_3) ; <<<< Delete Icon Image. GUIDelete($hGUI) _GDIPlus_Shutdown() EndFunc ;==>Example Func _GUICtrlMenu_SetItemImage($hImageFile, $iIndex, $hWnd = 0, $iWidth = 35, $iHeight = 35) ; Set Image to Tray/GUI Menu. $hWnd = TrayItemGetHandle($hWnd) Local $hImage = _GDIPlus_BitmapCreateFromFile($hImageFile) Local $iImageWidth = _GDIPlus_ImageGetWidth($hImage) Local $iImageHeight = _GDIPlus_ImageGetHeight($hImage) If ($iImageWidth < 0) Or ($iImageHeight < 0) Then Return SetError(1, 0, 0) EndIf If $iImageWidth < $iImageHeight Then $iImageWidth = $iWidth * $iImageWidth / $iImageHeight $iImageHeight = $iHeight Else $iImageHeight = $iHeight * $iImageHeight / $iImageWidth $iImageWidth = $iWidth EndIf Local $aResult = DllCall($ghGDIPDll, 'uint', 'GdipCreateBitmapFromScan0', 'int', $iWidth, 'int', $iHeight, 'int', 0, 'int', 0x0026200A, 'ptr', 0, 'int*', 0) Local $hBitmap = $aResult[6] Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsDrawImageRect($hContext, $hImage, 0, 0, $iWidth, $iHeight) Local $hIcon = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GUICtrlMenu_SetItemBmp($hWnd, $iIndex, $hIcon) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BitmapDispose($hBitmap) Return SetError(0, 0, $hIcon) EndFunc ;==>_GUICtrlMenu_SetItemImage Edited October 8, 2012 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now