Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tray icon tooltips
#1
I am trying to change the tool tip style on a tray icon too look more like vista and windows 7 system tray icon tool tips but have some difficultly modifying your code for add tray icon I could use some help on this one please.I tried adding nd.szInfo ,nd.szInfoTitle but i think i don't have the syntax correct .
#2
had no luck using tray functions so i came up with another solution
#3
not sure if this is the best solution but this is working
PLease let me know if there is a better solution..

Function test dialog
Code:
Copy      Help
,case WM_USER+101
,sel lParam
,,case WM_MOUSEMOVE
,,ShowTooltip2 tti 3 xm ym 200 3 "Tooltip Title" "lightning.ico"

Function ShowTrayTooltip
Code:
Copy      Help
;\
function $text timeS x y [maxTipWidth] [flags] [$title] [$titleIcon] ;;flags: 1 balloon (XP+), 2 asynchronous (don't wait). titleIcon: "info" "warning" "error"

;Shows tooltip that is not attached to a control.

;text - text.
;timeS - time to show, s.
;x, y - position in screen.
;maxTipWidth - max width. If nonzero, text can be multiline.
;flags:
;;;1 - balloon. Unavailable on Windows 2000.
;;;2 - don't wait until disappears. The function creates other thread to show the tooltip.
;title - title text. Max 99 characters.
;titleIcon - one of standard icons (see above). On Windows XP SP2 and later can be icon file.




if flags&2
,mac "ShowTrayTooltip" "" text timeS x y maxTipWidth flags~2 title titleIcon
,ret

int st=TTS_NOPREFIX|TTS_ALWAYSTIP|TTS_CLOSE
if(flags&1) st|TTS_BALLOON
int hwndTT = CreateWindowEx(WS_EX_TOPMOST TOOLTIPS_CLASS 0 st 0 0 0 0 0 0 0 0)

if(maxTipWidth) SendMessage(hwndTT, TTM_SETMAXTIPWIDTH, 0, maxTipWidth)

if !empty(title)
,int ic; if(!empty(titleIcon)) ic=SelStr(0 titleIcon "info" "warning" "error"); if(!ic) __Hicon _ic=GetFileIcon(titleIcon); ic=_ic
,SendMessage(hwndTT TTM_SETTITLEW ic @title)

TOOLINFOW ti.cbSize=44
ti.uFlags = TTF_TRACK
ti.lpszText=@text
SendMessage(hwndTT, TTM_ADDTOOLW, 0, &ti)

SendMessage(hwndTT, TTM_TRACKPOSITION, 0, MakeInt(x, y))
SendMessage(hwndTT, TTM_TRACKACTIVATE, 1, &ti)

opt waitmsg 1
wait timeS -WV hwndTT; err
DestroyWindow hwndTT
#4
On my computer NIF_INFO also does not work, whatever i try. Anyway, it is unreliable, depends on Windows version and various conditions. Your solution is better.
#5
It works yes but needs some tweaking.
If i use any other flag than 3 i get strange results.
Flags 0,1 and 4 (not sure what 0 and four are or if there are any other flags and what they mean exactly) create multiple tool tip windows.Flag 2 the tool tip appears in upper right hand corner of the screen(flag 0 does this as well).
The tool tip window can reappear as you are moving your mouse off of the tray icon.
#6
Function dialog_tray_icon_balloon_tooltip2
Code:
Copy      Help
Tray- t
sel message
,case WM_INITDIALOG
,t.AddIcon("$qm$\paste.ico" "" 1 hDlg)
,
,case WM_USER+101
,sel lParam
,,case WM_MOUSEMOVE
,,int- inTT
,,if !inTT
,,,inTT=1
,,,ShowTooltip "balloon" 3 xm ym 200 1 "Tooltip Title" "lightning.ico"
,,,inTT=0


Forum Jump:


Users browsing this thread: 1 Guest(s)