Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get OSD (on-screen display) width/height without actually rendering
#6
Yes the standard tooltips.
Below is the code for the function I use (I adjusted it slightly).
Don't remember where I got it from (Archive, Forum, QM itself...?)

It is no problem if not possible. Thank you anyway!

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

;Shows tooltip that is not attached to a control.

;color - [0]: none  OR =>  HEX values, examples  red: 0x0000ff , green: 0x00ff00 , blue: 0xff0000
;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.

;EXAMPLES
;ToolTip "tooltip" 2 100 100

;str s="Asynchronous balloon tooltip[]with title and icon."
;ToolTip s 10 xm ym 300 3 "title" "$qm$\info.ico"


if flags&2
,mac "ToolTip" "" 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)


;; ---- SET BORDERCOLOR ---------


if(color>0)    
,int w1=win("" "tooltips_class32")
,RECT rr
,GetWindowRect w1 &rr
,__OnScreenRect osr.SetStyle(color)
,osr.Show(1 rr)
;; ---- /SET BORDERCOLOR ---------


opt waitmsg 1
wait timeS -WV hwndTT; err


;; ---- HIDE BORDER ---------
if(color>0)
,osr.Show(2)
;; ---- /HIDE BORDER ---------


DestroyWindow hwndTT


Messages In This Thread
RE: Get OSD (on-screen display) width/height without actually rendering - by r0n - 03-16-2018, 08:26 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)