08-22-2012, 07:28 AM
Dear Gintaras,
Thanks for your response. It is a tolltip window produced with the ShowTooltip function above and I would like to have it moving attached to another window. I attach herewith your ShowTooltip function modified for this purpose, however, I do not like it, I am seeking something else more elegant.
Regards.
Function ShowTooltip_Attached
Thanks for your response. It is a tolltip window produced with the ShowTooltip function above and I would like to have it moving attached to another window. I attach herewith your ShowTooltip function modified for this purpose, however, I do not like it, I am seeking something else more elegant.
Regards.
Function ShowTooltip_Attached
;\
function $text hwnd x y [maxTipWidth] [flags] [IconFile] ;;flags: 1 balloon (XP+) 2 Play Sound 4 First line in text is title 8 Show Close Button
;Written by SES 120821191645
;Shows tooltip that is 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 relative to those of window hwnd
;maxTipWidth - max width. If nonzero, text can be multiline.
;IconFile : Intefer, Tooltip Icon, get it with ie. int IconFile=GetIcon(IconFile 0)
;For balloon :
;HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\EnableBalloonTips
;http://www.eggheadcafe.com/microsoft/VC-MFC/29399408/tooltip-not-showing-on-some-xp-computers.aspx
;http://support.microsoft.com/?id=307729
;C:\Documents and Settings\S.E.Simopoulos\My QM\Housekeeping\MicrosoftFixit50048.msi
;EXAMPLES
;ShowTooltip "test tooltip" 2 300 100
;mac "ShowTooltip" "" "test[]tooltip" 2 300 100 400 1
;With icon
;int IconFile=GetIcon("$user profile$\My Documents\Local Settings\sysman\Ico\djvu0409_dll_9.ico" 0)
;mac "ShowTooltip" "" "test[]tooltip" 4 300 100 400 1|2|4 IconFile
str stext=text ;; Added by SES on 111120193509
if(flags&4)
,str title.getl(text 0)
,stext.getl(text 1 2)
,
int st=TTS_NOPREFIX|TTS_ALWAYSTIP
if(flags&1) st|TTS_BALLOON
if(flags&2) bee "C:\WINDOWS\Media\Windows XP Balloon.wav"
;Show Close Button : It sould have also the following flags set : 1|4
if(flags&8) st|TTS_CLOSE
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=@stext
SendMessage(hwndTT, TTM_ADDTOOLW, 0, &ti)
;Add title and an icon to tooltip - Added by SES on 111120193509
if(flags&4)
,SendMessage(hwndTT TTM_SETTITLE IconFile title)
,DestroyIcon IconFile
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
int hx hy hxm hym
GetWinXY(hwnd hx hy)
mov hx+x hy+y hwndTT
hxm=hx
hym=hy
rep
,1
,if(flags&8)
,,if(hid(hwndTT)); break
,ifi- hwnd; break
,GetWinXY(hwnd hx hy)
,if hx=hxm and hy=hym; continue
,mov hx+x hy+y hwndTT
,hxm=hx
,hym=hy
,
DestroyWindow hwndTT