Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change the color of the font in a "ShowTooltip" routine
#1
I wonder whether I could change the color of the font in the routine which it follows.
Function ShowTooltip
Code:
Copy      Help
;\
function $text timeS x y [maxTipWidth] [flags] [IconFile] ;;flags: 1 balloon (XP+) 2 Play Sound 4 First line in text is title 8 Show Close Button 16 Fixed pitch font (_hfont)


;---> Comment 02-10-2015 10:20:57 : Flag16
;https://msdn.microsoft.com/en-us/library/windows/desktop/bb760250(v=vs.85).aspx
;SendMessageW hwndTT WM_SETFONT _hfont 0

;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.
;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("%IconFol%\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)
if(flags&16)
,iif(STT_Font STT_Font _hfont)
,SendMessageW hwndTT WM_SETFONT STT_Font 0


;Add title and an icon to tooltip - Added by SES on 111120193509

if(flags&4)
;,SendMessage(hwndTT TTM_SETTITLE IconFile title)
,SendMessage(hwndTT TTM_SETTITLEW 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 sec
if(flags&8)
,rep
,,1
,,sec=sec+1
,,if(hid(hwndTT) or sec>timeS); break
else
,wait timeS

DestroyWindow hwndTT

Any advice is mostly appreciated !


Forum Jump:


Users browsing this thread: 1 Guest(s)