Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Popup notification from tray icon
#1
Is it possible to have a popup notification (message, bubble, etc...) come from a a tray bar icon? When I minimize my dialog & it hides and creates a tray icon I would like a message to automatically popup telling the user that they can re-activate the window by clicking the icon.

Thanks
#2
Use...

Function dialog_tray_icon
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

if(!ShowDialog("dialog_tray_icon" &dialog_tray_icon 0)) ret

;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;2 Button 0x54030000 0x4 120 116 48 14 "Hide"
;3 Button 0x54032000 0x0 172 116 48 14 "Exit"
;END DIALOG
;DIALOG EDITOR: "" 0x2030300 "*" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,
,Tray-- t_ti
,t_ti.AddIcon("$qm$\copy.ico" "tooltip" 5 hDlg)
,;clo hDlg ;;hide
,
,case WM_DESTROY
,t_ti.Delete
,
,case WM_USER+101
,sel lParam
,,case WM_LBUTTONUP ;;on left click tray icon
,,;gShow
,,act hDlg; err
,,
,,case WM_RBUTTONUP ;;on right click tray icon
,,sel ShowMenu("1 Show[]2 Exit" hDlg)
,,,case 1 goto gShow
,,,case 2 goto gExit
,
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDCANCEL ;;Hide, X
,min hDlg; hid hDlg
,int x y cx cy; GetWinXY id(1504 win("" "Shell_TrayWnd")) x y cx cy
,ShowTooltip "test tooltip" 2 x y 0 1 ;;remove flag 1 for tooltip type, flag 1 makes bubble (xp+ only)
,ret
,
,
,case 3 ;;Exit
,;gExit
,DT_Cancel hDlg
ret 1

You need this...

Function ShowTooltip
Code:
Copy      Help
;\
function $text timeS x y [maxTipWidth] [flags] ;;flags: 1 balloon (XP+)

;Shows tooltip that is not attached to a control.
;Shows synchronously, ie waits timeS seconds. To show async, run in other thread (mac).

;text - text.
;timeS - time to show, s.
;x, y - position in screen.
;maxTipWidth - max width. If nonzero, text can be multiline.

;EXAMPLES
;ShowTooltip "test tooltip" 2 300 100

;mac "ShowTooltip" "" "test[]tooltip" 2 300 100 400 1


int st=TTS_NOPREFIX|TTS_ALWAYSTIP
if(flags&1) st|TTS_BALLOON
int hwndTT = CreateWindowEx(WS_EX_TOPMOST TOOLTIPS_CLASS 0 st 0 0 0 0 0 0 0 0)
TOOLINFOW ti.cbSize=44
ti.uFlags = TTF_TRACK
ti.lpszText=@text
SendMessage(hwndTT, TTM_ADDTOOLW, 0, &ti)
if(maxTipWidth) SendMessage(hwndTT, TTM_SETMAXTIPWIDTH, 0, maxTipWidth)
SendMessage(hwndTT, TTM_TRACKPOSITION, 0, MakeInt(x, y))
SendMessage(hwndTT, TTM_TRACKACTIVATE, 1, &ti)

opt waitmsg 1
wait timeS

DestroyWindow hwndTT
#3
That's great! Thank you


Forum Jump:


Users browsing this thread: 1 Guest(s)