Yashied Posted May 19, 2012 Posted May 19, 2012 (edited) LAST VERSION - 1.019-May-12I think many of you would like to perform some action (for example, to call the dialog box) when a user clicks on the tray tip. Here is a simple way to do it. Unfortunately, without .dll do not seem possible. Note, only AutoIt window can be registered as a source window, see example.AITray.dll (x86 and x64)Previous downloads: 74AITray.zipExampleexpandcollapse popup#Include <WindowsConstants.au3> Opt('TrayAutoPause', 0) Opt('WinTitleMatchMode', 3) Opt('WinWaitDelay', 0) Global Const $NIN_BALLOONSHOW = $WM_USER + 2 Global Const $NIN_BALLOONHIDE = $WM_USER + 3 Global Const $NIN_BALLOONUSERCLICK = $WM_USER + 5 Global Const $NIN_BALLOONTIMEOUT = $WM_USER + 4 $hForm = GUICreate('') If @AutoItX64 Then $hDll = DllOpen(@ScriptDir & '\AITray_x64.dll') Else $hDll = DllOpen(@ScriptDir & '\AITray.dll') EndIf If $hDll <> -1 Then $Ret = DllCall($hDll, 'int', 'AISetTrayRedirection', 'hwnd', WinGetHandle(AutoItWinGetTitle()), 'hwnd', $hForm) If (@Error) Or (Not $Ret[0]) Then DllClose($hDll) Exit EndIf Else Exit EndIf GUIRegisterMsg($WM_USER + 1, 'WM_TRAYNOTIFY') TrayTip('Tip', 'This is a tray tip, click here.', 10, 1) While 1 Sleep(1000) WEnd DllCall($hDll, 'int', 'AIRemoveTrayRedirection') DllClose($hDll) Func WM_TRAYNOTIFY($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hForm Switch $lParam Case $NIN_BALLOONSHOW ConsoleWrite('Balloon tip show.' & @CR) Case $NIN_BALLOONHIDE ConsoleWrite('Balloon tip hide.' & @CR) Case $NIN_BALLOONUSERCLICK ConsoleWrite('Balloon tip click.' & @CR) Case $NIN_BALLOONTIMEOUT ConsoleWrite('Balloon tip close.' & @CR) EndSwitch EndSwitch EndFunc ;==>WM_TRAYNOTIFY Edited December 10, 2013 by Yashied JScript, Venix, genius257 and 1 other 3 1 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...
JScript Posted May 19, 2012 Posted May 19, 2012 Wow, very niceee, I liked! ***** from me.And about this DLL?Regards,João Carlos. http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere!
Yashied Posted May 19, 2012 Author Posted May 19, 2012 And about this DLL? expandcollapse popup#WM_TRAYNOTIFY = #WM_USER + 1 Prototype.l SetWindowSubclass(*HWnd, *HProc, ID.i = 1000, IParam.i = 0) Prototype.l RemoveWindowSubclass(*HWnd, *HProc, ID.i = 1000) Global Comctl32.l = OpenLibrary(#PB_Any, "comctl32.dll") Global User32.l = OpenLibrary(#PB_Any, "user32.dll") Global AutoIt.i = 0 Global Target.i = 0 Procedure.i SubclassProc(*HWnd, Msg.l, *WParam, *LParam, *ID, *IParam) Select Msg Case #WM_TRAYNOTIFY Select *LParam Case #NIN_BALLOONSHOW, #NIN_BALLOONHIDE, #NIN_BALLOONUSERCLICK, #NIN_BALLOONTIMEOUT If Target CallFunction(User32, "PostMessageW", Target, Msg, *WParam, *LParam) EndIf EndSelect EndSelect ProcedureReturn CallFunction(Comctl32, "DefSubclassProc", *HWnd, Msg, *WParam, *LParam) EndProcedure ProcedureDLL.l AIRemoveTrayRedirection() If Not AutoIt ProcedureReturn 0 EndIf RemoveWindowSubclass.RemoveWindowSubclass = GetFunction(Comctl32, "RemoveWindowSubclass") If IsWindow(AutoIt) If Not RemoveWindowSubclass(AutoIt, @SubclassProc()) ProcedureReturn 0 EndIf EndIf Target = 0 AutoIt = 0 ProcedureReturn 1 EndProcedure ProcedureDLL.l AISetTrayRedirection(*HAutoIt, *HTarget) If (Not *HAutoIt) Or (Not *HTarget) ProcedureReturn 0 EndIf If AutoIt If Not AIRemoveTrayRedirection() ProcedureReturn 0 EndIf EndIf SetWindowSubclass.SetWindowSubclass = GetFunction(Comctl32, "SetWindowSubclass") If Not SetWindowSubclass(*HAutoIt, @SubclassProc()) ProcedureReturn 0 EndIf AutoIt = *HAutoIt Target = *HTarget ProcedureReturn 1 EndProcedure 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...
JScript Posted May 20, 2012 Posted May 20, 2012 Ok, Is there any chance of making entirely in Autoit? Regards, João Carlos. http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere!
Yashied Posted May 20, 2012 Author Posted May 20, 2012 Is there any chance of making entirely in Autoit?No, DllCallbackRegister() kill the script. 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...
wakillon Posted May 20, 2012 Posted May 20, 2012 Again a nice and new feature ! Thanks Yashield ! AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
Venix Posted May 20, 2012 Posted May 20, 2012 Love it , much better than having to set the coordinates.
UEZ Posted May 20, 2012 Posted May 20, 2012 What language is the code from the DLL? Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Yashied Posted May 20, 2012 Author Posted May 20, 2012 What language is the code from the DLL?PureBasic 4.50 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...
JScript Posted May 20, 2012 Posted May 20, 2012 (edited) PureBasic!!!!Wow, I will endeavor to eliminate this dll, leaving only in AutoIt... Regards,João Carlos. Edited May 20, 2012 by JScript http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere!
ProgAndy Posted May 20, 2012 Posted May 20, 2012 (edited) No, DllCallbackRegister() kill the script. We just need a small ASM-stub to hook the window procedure and forwards WM_TRAYNOTIFY when the TrayClick is registered. Edit: Does this seem about right? Values not yet read from stack, only symbols: use32 test uMsg, WM_TRAYNOTIFY jz skip_notify push lparam push wparam push uMsg push hWndRedirect call PostMessage skip_notify: push lparam push wparam push uMsg push hWnd call DefSubclassProc ret 24 Edited May 20, 2012 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
wraithdu Posted May 21, 2012 Posted May 21, 2012 (edited) Ok, Is there any chance of making entirely in Autoit? No, DllCallbackRegister() kill the script. Pure AutoIt works for me... expandcollapse popup#include <windowsconstants.au3> Opt('TrayAutoPause', 0) Opt('WinTitleMatchMode', 3) Opt('WinWaitDelay', 0) Opt('TrayMenuMode', 3) Global Const $WM_TRAYNOTIFY = $WM_USER + 1 Global Const $NIN_BALLOONSHOW = $WM_USER + 2 Global Const $NIN_BALLOONHIDE = $WM_USER + 3 Global Const $NIN_BALLOONUSERCLICK = $WM_USER + 5 Global Const $NIN_BALLOONTIMEOUT = $WM_USER + 4 Global Const $subID = 1234 Global $iTip = 2 Global $psub = DllCallbackRegister("_subclass", "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr") Global $hForm = GUICreate('') DllCall("comctl32.dll", "bool", "SetWindowSubclass", "hwnd", WinGetHandle(AutoItWinGetTitle()), "ptr", DllCallbackGetPtr($psub), "uint_ptr", $subID, "dword_ptr", 0) GUIRegisterMsg($WM_TRAYNOTIFY, 'WM_TRAYNOTIFY') Global $iShow = TrayCreateItem("Show New Tip") TrayCreateItem("") Global $iExit = TrayCreateItem("Exit") TrayTip('Tip', 'This is a tray tip, click here.', 10, 1) While 1 Switch TrayGetMsg() Case $iShow TrayTip('Tip', 'This is a tray tip, click here. [ ' & $iTip & ' ]', 10, 1) $iTip += 1 Case $iExit ExitLoop EndSwitch WEnd DllCall("comctl32.dll", "bool", "RemoveWindowSubclass", "hwnd", WinGetHandle(AutoItWinGetTitle()), "ptr", DllCallbackGetPtr($psub), "uint_ptr", $subID) DllCallbackFree($psub) Func WM_TRAYNOTIFY($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hForm Switch $lParam Case $NIN_BALLOONSHOW ConsoleWrite('Balloon tip show.' & @CR) Case $NIN_BALLOONHIDE ConsoleWrite('Balloon tip hide.' & @CR) Case $NIN_BALLOONUSERCLICK ConsoleWrite('Balloon tip click.' & @CR) Case $NIN_BALLOONTIMEOUT ConsoleWrite('Balloon tip close.' & @CR) EndSwitch EndSwitch EndFunc ;==>WM_TRAYNOTIFY Func _subclass($hwnd, $uMsg, $wParam, $lParam, $uIdSubclass, $dwRefData) #forceref $hwnd, $uMsg, $wParam, $lParam, $uIdSubclass, $dwRefData Switch $uMsg Case $WM_TRAYNOTIFY Switch $uIdSubclass Case $subID Switch $lParam Case $NIN_BALLOONSHOW, $NIN_BALLOONHIDE, $NIN_BALLOONUSERCLICK, $NIN_BALLOONTIMEOUT If $hForm Then DllCall("user32.dll", "bool", "PostMessageW", "hwnd", $hForm, "uint", $uMsg, "wparam", $wParam, "lparam", $lParam) EndIf EndSwitch EndSwitch EndSwitch Local $ret = DllCall("comctl32.dll", "lresult", "DefSubclassProc", "hwnd", $hwnd, "uint", $uMsg, "wparam", $wParam, "lparam", $lParam) Return $ret[0] EndFunc However as noted in MSDN in the comments, there is no differentiation between a timeout and a close event. Seems like a Windows bug. Edited May 21, 2012 by wraithdu JScript 1
JScript Posted May 21, 2012 Posted May 21, 2012 Yeah, I know it could be done in AutoIt! Regards, João Carlos. http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere!
Yashied Posted May 21, 2012 Author Posted May 21, 2012 why I did not use DllCallbackRegister(). 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...
Yashied Posted May 21, 2012 Author Posted May 21, 2012 (edited) The problem in the default AutoIt tray menu... but with .dll everything works fine anywhere. What's the catch? Edited May 21, 2012 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...
wraithdu Posted May 21, 2012 Posted May 21, 2012 I did it with a custom menu to exit the loop and gracefully unsubclass the window and free the callback before exiting. Works fine every time. Did you try my version?
Yashied Posted May 21, 2012 Author Posted May 21, 2012 (edited) wraithdu, please comment the following lines and try to close the script from the tray. ;Opt('TrayAutoPause', 0) Opt('WinTitleMatchMode', 3) Opt('WinWaitDelay', 0) ;Opt('TrayMenuMode', 3) Edited May 21, 2012 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...
UEZ Posted May 21, 2012 Posted May 21, 2012 Can confirm that wraithdu's code works properly on my machine (Win7 x64 running it at x86 & x64 mode)! Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
wraithdu Posted May 21, 2012 Posted May 21, 2012 (edited) wraithdu, please comment the following lines and try to close the script from the tray. ;Opt('TrayAutoPause', 0) Opt('WinTitleMatchMode', 3) Opt('WinWaitDelay', 0) ;Opt('TrayMenuMode', 3) Why would I purposely break it? If it is required to change the menu mode so you can exit properly, then do it! You must unsubclass and unregister the callback. You can't do that from the default tray menu, unless you want to add a function with OnAutoItExitRegister (didn't try, but would probably also work). Edited May 21, 2012 by wraithdu
wraithdu Posted May 21, 2012 Posted May 21, 2012 (edited) So do it this way: expandcollapse popup#include <windowsconstants.au3> Opt('TrayAutoPause', 0) Opt('WinTitleMatchMode', 3) Opt('WinWaitDelay', 0) Opt('TrayMenuMode', 2) Global Const $WM_TRAYNOTIFY = $WM_USER + 1 Global Const $NIN_BALLOONSHOW = $WM_USER + 2 Global Const $NIN_BALLOONHIDE = $WM_USER + 3 Global Const $NIN_BALLOONUSERCLICK = $WM_USER + 5 Global Const $NIN_BALLOONTIMEOUT = $WM_USER + 4 Global Const $subID = 1234 Global $iTip = 2 Global $psub = DllCallbackRegister("_subclass", "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr") Global $hForm = GUICreate('') DllCall("comctl32.dll", "bool", "SetWindowSubclass", "hwnd", WinGetHandle(AutoItWinGetTitle()), "ptr", DllCallbackGetPtr($psub), "uint_ptr", $subID, "dword_ptr", 0) GUIRegisterMsg($WM_TRAYNOTIFY, 'WM_TRAYNOTIFY') OnAutoItExitRegister("SafeExit") Global $iShow = TrayCreateItem("Show New Tip") ;~ TrayCreateItem("") ;~ Global $iExit = TrayCreateItem("Exit") TrayTip('Tip', 'This is a tray tip, click here.', 10, 1) While 1 Switch TrayGetMsg() Case $iShow TrayTip('Tip', 'This is a tray tip, click here. [ ' & $iTip & ' ]', 10, 1) $iTip += 1 ;~ Case $iExit ;~ ExitLoop EndSwitch ;~ Sleep(1000) WEnd ;~ DllCall("comctl32.dll", "bool", "RemoveWindowSubclass", "hwnd", WinGetHandle(AutoItWinGetTitle()), "ptr", DllCallbackGetPtr($psub), "uint_ptr", $subID) ;~ DllCallbackFree($psub) Func SafeExit() ConsoleWrite("exiting..." & @CRLF) DllCall("comctl32.dll", "bool", "RemoveWindowSubclass", "hwnd", WinGetHandle(AutoItWinGetTitle()), "ptr", DllCallbackGetPtr($psub), "uint_ptr", $subID) DllCallbackFree($psub) EndFunc Func WM_TRAYNOTIFY($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hForm Switch $lParam Case $NIN_BALLOONSHOW ConsoleWrite('Balloon tip show.' & @CR) Case $NIN_BALLOONHIDE ConsoleWrite('Balloon tip hide.' & @CR) Case $NIN_BALLOONUSERCLICK ConsoleWrite('Balloon tip click.' & @CR) Case $NIN_BALLOONTIMEOUT ConsoleWrite('Balloon tip close.' & @CR) EndSwitch EndSwitch EndFunc ;==>WM_TRAYNOTIFY Func _subclass($hwnd, $uMsg, $wParam, $lParam, $uIdSubclass, $dwRefData) #forceref $hwnd, $uMsg, $wParam, $lParam, $uIdSubclass, $dwRefData Switch $uMsg Case $WM_TRAYNOTIFY Switch $uIdSubclass Case $subID Switch $lParam Case $NIN_BALLOONSHOW, $NIN_BALLOONHIDE, $NIN_BALLOONUSERCLICK, $NIN_BALLOONTIMEOUT If $hForm Then DllCall("user32.dll", "bool", "PostMessageW", "hwnd", $hForm, "uint", $uMsg, "wparam", $wParam, "lparam", $lParam) EndIf EndSwitch EndSwitch EndSwitch Local $ret = DllCall("comctl32.dll", "lresult", "DefSubclassProc", "hwnd", $hwnd, "uint", $uMsg, "wparam", $wParam, "lparam", $lParam) Return $ret[0] EndFunc Edited May 21, 2012 by wraithdu
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