Balloontips with icons & titles
Posted: Sun Nov 02, 2003 8:34 pm
Hi, my first post here! I haven't seen the code for doing neat balloon-style tooltips with icons & titles here before so I thought I'd post this. Can't remember who posted the original code for doing regular balloontips, but many thanks to him anyway.
Have fun.
~ B
Code: Select all
Procedure AddToolTip(Handle, Text$, Icon, Title$)
ToolTipControl = CreateWindowEx_(0, "tooltips_class32", "", $D0000000 | #TTS_BALLOON, 0, 0, 0, 0, WindowID(), 0, GetModuleHandle_(0), 0)
SendMessage_(ToolTipControl, 1048, 0, 200) ; *** Size control
SendMessage_(ToolTipControl, $413, GetSysColor_(#COLOR_INFOBK), 0) ; *** Color control
SendMessage_(ToolTipControl, $414, GetSysColor_(#COLOR_INFOTEXT), 0) ; *** Color control
; *** You could also use something like #COLOR_WINDOW and #COLOR_WINDOWTEXT, or omit these two above lines for default tooltip colors
LoadFont(1, "Tahoma", 8) : UseFont(1)
SendMessage_(ToolTipControl, #WM_SETFONT, FontID(), #TRUE) ; *** Font control
; *** You can omit these lines for the default tooltip font
Temporary.ToolInfo\cbSize = 44
Temporary\uFlags = #TTF_SUBCLASS | #TTF_IDISHWND
Temporary\hWnd = Handle
Temporary\uId = Handle
Temporary\lpszText = @Text$
; TTI_NONE = 0 (no icon)
; TTI_INFO = 1 (information icon)
; TTI_WARNING = 2 (warning icon)
; TTI_ERROR = 3 (error icon)
SendMessage_(ToolTipControl, #TTM_SETTITLE, Icon, Title$) ; *** Adds icon and title in bold
SendMessage_(ToolTipControl, #TTM_ADDTOOL, 0, Temporary)
EndProcedure
~ B