Click here to Skip to main content
Click here to Skip to main content

How to implement Windows XP style balloon tooltip using API in VB

, 6 Dec 2005
Rate this:
Please Sign up or sign in to vote.
Very easy to implement ready to use vb class for balloon style tooltip.

Sample screenshot


This article is brought to you by BinaryWorld

URL: http://www.BinaryWorld.net/

Search more than 3500 VB/VB.net/ASP.net SQL Server source code and articles

Dont miss Binaryworld Exclusive API Dictionary...

Click here to check API Dictionary On Binaryworld

Search more than 6185 APIs, 55646 Constants, 455 Types and 985 Examples in our API Dictionary.


Introduction





Using api you can create ballon style tooltip. You can also set varous parameter for tooltip i.e. Delay time, Style, Color etc...

I have implemented a class for Balloon style tooltip.

To run this demo perform the following steps
- Create a standard exe project
- Add a class module rename class1 to CBalloonToolTip
- Add 2 textbox and one command button on form1
- Place Following code in form1

Form1.frm




Dim TT1 As New CBalloonToolTip                            '//Demo for On Demand tooltip
Dim TT2 As New CBalloonToolTip                            '//Demo for mouse over tooltip

Private Declare Function <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=1740">GetKeyState</A> Lib "user32" (ByVal nVirtKey As Long) As Integer

Public Function CapsLockOn() As Boolean
   Dim iKeyState As Integer
   iKeyState = <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=1740">GetKeyState</A>(vbKeyCapital)
   CapsLockOn = (iKeyState = 1 Or iKeyState = -127)
End Function

Private Sub Command1_Click()
   If Text1.Text <> "mypassword" Then
       TT1.Style = TTBalloon
       TT1.Icon = TTIconError
       TT1.Title = IIf(Text1.Text = "", "Blank Password", "Invalid Password")
       TT1.TipText = "Please Enter Correct Password..."
       TT1.PopupOnDemand = True
       TT1.CreateToolTip Text1.hwnd
       TT1.Show 0, Text1.Height / Screen.TwipsPerPixelX - 1    '//In Pixel only
    End If
End Sub

Private Sub Form_Load()
   TT2.Style = TTBalloon
   TT2.Icon = TTIconInfo
   TT2.Title = "Information"
   TT2.TipText = "A little cute tooltip for Textbox2"
   TT2.PopupOnDemand = False
   TT2.ForeColor = vbWhite
   TT2.BackColor = &HCE7110
   TT2.VisibleTime = 6000                                'After 6 Seconds tooltip will go away
    TT2.CreateToolTip Text2.hwnd
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
   TT1.Destroy
End Sub

Private Sub Form_Paint()
   TT1.Destroy
End Sub

Private Sub Form_Resize()
   TT1.Destroy
End Sub
Private Sub Form_Unload(Cancel As Integer)
   TT1.Destroy
   TT2.Destroy
End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
   If CapsLockOn Then
       TT1.Style = TTBalloon
       TT1.Icon = TTIconWarning
       TT1.Title = "Caps Lock is on"
       TT1.TipText = "Check your caps lock key..."
       TT1.CreateToolTip Text1.hwnd
       TT1.Show 0, Text1.Height / Screen.TwipsPerPixelX - 1
   Else
       TT1.Destroy
   End If
End Sub

Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
   TT1.Destroy
End Sub

Add the following code in class module

CBalloonToolTip.cls

Option Explicit

Private Declare Sub <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=2339">InitCommonControls</A> Lib "comctl32.dll" ()

''Windows API Functions
Private Declare Function <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=118">CreateWindowEx</A> Lib "user32.dll" Alias "CreateWindowExA" ( _
       ByVal dwExStyle As Long, _
       ByVal lpClassName As String, _
       ByVal lpWindowName As String, _
       ByVal dwStyle As Long, _
       ByVal X As Long, _
       ByVal Y As Long, _
       ByVal nWidth As Long, _
       ByVal nHeight As Long, _
       ByVal hWndParent As Long, _
       ByVal hMenu As Long, _
       ByVal hInstance As Long, _
       ByRef lpParam As Any) As Long

Private Declare Function <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=4645">SendMessage</A> Lib "user32.dll" Alias "SendMessageA" ( _
       ByVal hwnd As Long, _
       ByVal wMsg As Long, _
       ByVal wParam As Long, _
       ByRef lParam As Any) As Long

Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" ( _
       ByVal hwnd As Long, _
       ByVal wMsg As Long, _
       ByVal wParam As Long, _
       ByVal lParam As Long) As Long

Private Declare Function <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=161">DestroyWindow</A> Lib "user32" ( _
       ByVal hwnd As Long) As Long

Private Declare Function <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=55">ClientToScreen</A> Lib "user32" ( _
       ByVal hwnd As Long, _
       lpPoint As <A class=Api3 title="Click to view Structure Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=6568">POINTAPI</A>) As Long

''Windows API Constants
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=61147">WM_USER</A> = &H400
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=14022">CW_USEDEFAULT</A> = &H80000000

''Windows API Types
Private Type <A class=Api3 title="Click to view Structure Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=6593">RECT</A>
   left As Long
   top As Long
   right As Long
   bottom As Long
End Type

Private Type <A class=Api3 title="Click to view Structure Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=6568">POINTAPI</A>
   X As Long
   Y As Long
End Type

'Tooltip Window Constants
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58296">TTS_NOPREFIX</A> = &H2
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58233">TTF_TRANSPARENT</A> = &H100
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58227">TTF_CENTERTIP</A> = &H2
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58239">TTM_ADDTOOLA</A> = (<A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=61147">WM_USER</A> + 4)
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58238">TTM_ACTIVATE</A> = <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=61147">WM_USER</A> + 1
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58279">TTM_UPDATETIPTEXTA</A> = (<A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=61147">WM_USER</A> + 12)
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58268">TTM_SETMAXTIPWIDTH</A> = (<A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=61147">WM_USER</A> + 24)
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58269">TTM_SETTIPBKCOLOR</A> = (<A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=61147">WM_USER</A> + 19)
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58270">TTM_SETTIPTEXTCOLOR</A> = (<A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=61147">WM_USER</A> + 20)
Private Const TTM_SETTITLE = (<A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=61147">WM_USER</A> + 32)
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58293">TTS_BALLOON</A> = &H40
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58292">TTS_ALWAYSTIP</A> = &H1
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58231">TTF_SUBCLASS</A> = &H10
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58232">TTF_TRACK</A> = &H20
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58229">TTF_IDISHWND</A> = &H1
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58266">TTM_SETDELAYTIME</A> = (<A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=61147">WM_USER</A> + 3)
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58223">TTDT_AUTOPOP</A> = 2
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58224">TTDT_INITIAL</A> = 3
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58276">TTM_TRACKACTIVATE</A> = <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=61147">WM_USER</A> + 17
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58277">TTM_TRACKPOSITION</A> = <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=61147">WM_USER</A> + 18
Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=61550">WS_POPUP</A> = &H80000000

Private Const <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=57908">TOOLTIPS_CLASSA</A> = "tooltips_class32"

''Tooltip Window Types
Private Type <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=57903">TOOLINFO</A>
   lSize As Long
   lFlags As Long
   hwnd As Long
   lId As Long
   lpRect As <A class=Api3 title="Click to view Structure Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=6593">RECT</A>
   hInstance As Long
   lpStr As String
   lParam As Long
End Type


Public Enum ttIconType
   TTNoIcon = 0
   TTIconInfo = 1
   TTIconWarning = 2
   TTIconError = 3
End Enum

Public Enum ttStyleEnum
   TTStandard
   TTBalloon
End Enum

'local variable(s) to hold property value(s)
Private mvarBackColor As Long
Private mvarTitle As String
Private mvarForeColor As Long
Private mvarIcon As ttIconType
Private mvarCentered As Boolean
Private mvarStyle As ttStyleEnum
Private mvarTipText As String
Private mvarVisibleTime As Long
Private mvarDelayTime As Long
Private mvarPopupOnDemand As Boolean

'private data
Private m_lTTHwnd As Long                                  ' hwnd of the tooltip
Private m_lParentHwnd As Long                              ' hwnd of the window the tooltip attached to
Private ti As <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=57903">TOOLINFO</A>

Private Sub Class_Initialize()
   <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=2339">InitCommonControls</A>
   mvarDelayTime = 500
   mvarVisibleTime = 5000
   mvarPopupOnDemand = False
End Sub
Private Sub Class_Terminate()
   Destroy
End Sub
'//////////////////////////////////////////////////////
Public Property Get VisibleTime() As Long
   VisibleTime = mvarVisibleTime
End Property
Public Property Let VisibleTime(ByVal lData As Long)
   mvarVisibleTime = lData
End Property
'//////////////////////////////////////////////////////
Public Property Get DelayTime() As Long
   DelayTime = mvarDelayTime
End Property
Public Property Let DelayTime(ByVal lData As Long)
   mvarDelayTime = lData
End Property
'//////////////////////////////////////////////////////
Public Property Let Icon(ByVal vData As ttIconType)
   mvarIcon = vData
   If m_lTTHwnd <> 0 And mvarTitle <> Empty And mvarIcon <> TTNoIcon Then
       <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=4645">SendMessage</A> m_lTTHwnd, TTM_SETTITLE, CLng(mvarIcon), ByVal mvarTitle
   End If
End Property
Public Property Get Icon() As ttIconType
   Icon = mvarIcon
End Property
'//////////////////////////////////////////////////////
Public Property Let ForeColor(ByVal vData As Long)
   mvarForeColor = vData
   If m_lTTHwnd <> 0 Then
       <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=4645">SendMessage</A> m_lTTHwnd, <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58270">TTM_SETTIPTEXTCOLOR</A>, mvarForeColor, 0&
   End If
End Property
Public Property Get ForeColor() As Long
   ForeColor = mvarForeColor
End Property
'//////////////////////////////////////////////////////
Public Property Let Title(ByVal vData As String)
   mvarTitle = vData
   If m_lTTHwnd <> 0 And mvarTitle <> Empty And mvarIcon <> TTNoIcon Then
       <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=4645">SendMessage</A> m_lTTHwnd, TTM_SETTITLE, CLng(mvarIcon), ByVal mvarTitle
   End If
End Property
Public Property Get Title() As String
   Title = ti.lpStr
End Property
'//////////////////////////////////////////////////////
Public Property Let PopupOnDemand(ByVal vData As Boolean)
   mvarPopupOnDemand = vData
   'If m_lTTHwnd <> 0 Then
    'End If
End Property
Public Property Get PopupOnDemand() As Boolean
   PopupOnDemand = mvarPopupOnDemand
End Property
'//////////////////////////////////////////////////////
Public Property Let BackColor(ByVal vData As Long)
   mvarBackColor = vData
   If m_lTTHwnd <> 0 Then
       <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=4645">SendMessage</A> m_lTTHwnd, <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58269">TTM_SETTIPBKCOLOR</A>, mvarBackColor, 0&
   End If
End Property
Public Property Get BackColor() As Long
   BackColor = mvarBackColor
End Property
'//////////////////////////////////////////////////////
Public Property Let TipText(ByVal vData As String)
   mvarTipText = vData
   ti.lpStr = vData
   If m_lTTHwnd <> 0 Then
       <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=4645">SendMessage</A> m_lTTHwnd, <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58279">TTM_UPDATETIPTEXTA</A>, 0&, ti
   End If
End Property
Public Property Get TipText() As String
   TipText = mvarTipText
End Property
'//////////////////////////////////////////////////////
Public Property Let Style(ByVal vData As ttStyleEnum)
   mvarStyle = vData
End Property
Public Property Get Style() As ttStyleEnum
   Style = mvarStyle
End Property
'//////////////////////////////////////////////////////
Public Property Let <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=10454">Centered</A>(ByVal vData As Boolean)
   mvarCentered = vData
End Property
Public Property Get <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=10454">Centered</A>() As Boolean
   <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=10454">Centered</A> = mvarCentered
End Property

'X and Y are in Pixel so dont <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=4639">send</A> vbTwips value
Public Sub Show(Optional X As Long = 0, Optional Y As Long = 0)

   Dim pt As <A class=Api3 title="Click to view Structure Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=6568">POINTAPI</A>
   Dim ptTip As Long
   Dim ret As Long

   With pt
       .X = X
       .Y = Y
   End With

   ret = <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=55">ClientToScreen</A>(Form1.Text1.hwnd, pt)

   ptTip = pt.Y * &H10000
   ptTip = ptTip + pt.X

   ' These two messages will set the position of the tooltip:
    ret = <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=4645">SendMessage</A>(m_lTTHwnd, <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58277">TTM_TRACKPOSITION</A>, 0, ByVal ptTip)
   ret = <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=4645">SendMessage</A>(m_lTTHwnd, <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58276">TTM_TRACKACTIVATE</A>, True, ti)

End Sub
Public Function CreateToolTip(ByVal ParentHwnd As Long) As Boolean
   Dim lWinStyle As Long
   If m_lTTHwnd <> 0 Then
       <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=161">DestroyWindow</A> m_lTTHwnd
   End If
   m_lParentHwnd = ParentHwnd

   ''create baloon style if desired
    If mvarStyle = TTBalloon Then lWinStyle = lWinStyle Or <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58293">TTS_BALLOON</A>

   m_lTTHwnd = <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=118">CreateWindowEx</A>(0&, _
           <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=57908">TOOLTIPS_CLASSA</A>, _
           vbNullString, _
           lWinStyle, _
           0&, _
           0&, _
           0&, _
           0&, _
           m_lParentHwnd, _
           0&, _
           0&, _
           0&)

   ''now set our tooltip info structure
    With ti
       '//dont incude <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58231">TTF_SUBCLASS</A> for on demand
        ''if we want it <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=10454">centered</A>, then set that flag
        If mvarCentered Then
           If mvarPopupOnDemand = False Then
               .lFlags = <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58231">TTF_SUBCLASS</A> Or <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58227">TTF_CENTERTIP</A> Or <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58229">TTF_IDISHWND</A>
           Else
               .lFlags = <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58229">TTF_IDISHWND</A> Or <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58232">TTF_TRACK</A> Or <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58227">TTF_CENTERTIP</A>
           End If
       Else
           If mvarPopupOnDemand = False Then
               .lFlags = <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58231">TTF_SUBCLASS</A> Or <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58229">TTF_IDISHWND</A>
           Else
               .lFlags = <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58229">TTF_IDISHWND</A> Or <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58232">TTF_TRACK</A> Or <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58233">TTF_TRANSPARENT</A>
           End If
       End If

       'set the hwnd prop to our parent control's hwnd
        .hwnd = m_lParentHwnd
       .lId = m_lParentHwnd                              '0
        .hInstance = App.hInstance
       '.lpstr = ALREADY SET
        '.lpRect = lpRect
        .lSize = Len(ti)
   End With

   ''add the tooltip structure
    <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=4645">SendMessage</A> m_lTTHwnd, <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58239">TTM_ADDTOOLA</A>, 0&, ti

   ''if we want a title or we want an icon
    If mvarTitle <> vbNullString Or mvarIcon <> TTNoIcon Then
       <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=4645">SendMessage</A> m_lTTHwnd, TTM_SETTITLE, CLng(mvarIcon), ByVal mvarTitle
   End If

   If mvarForeColor <> Empty Then
       <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=4645">SendMessage</A> m_lTTHwnd, <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58270">TTM_SETTIPTEXTCOLOR</A>, mvarForeColor, 0&
   End If

   If mvarBackColor <> Empty Then
       <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=4645">SendMessage</A> m_lTTHwnd, <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58269">TTM_SETTIPBKCOLOR</A>, mvarBackColor, 0&
   End If

   SendMessageLong m_lTTHwnd, <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58266">TTM_SETDELAYTIME</A>, <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58223">TTDT_AUTOPOP</A>, mvarVisibleTime
   SendMessageLong m_lTTHwnd, <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58266">TTM_SETDELAYTIME</A>, <A class=Api2 title="Click to view Constant Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=58224">TTDT_INITIAL</A>, mvarDelayTime

End Function

Public Sub Destroy()
   If m_lTTHwnd <> 0 Then
       <A class=Api1 title="Click to view API Description" href="http://binaryworld.no-ip.info/Main/ApiDetail.aspx?ApiId=161">DestroyWindow</A> m_lTTHwnd
   End If
End Sub

Submitted By : Nayan Patel
Job Description : Currently he is working as an independent consultant. He has experience with VB.net/ASP.net, SQL and other MS technologies. He is MCSD.net, MCDBA and MCSE. He is moderator of binaryworld ( URL: http://BinaryWorld.net. )
View all (455) submissions by this author

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

NSPatel38
Web Developer
United States United States
Currently he is working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.

Comments and Discussions

 
QuestionVery good Class / Create with close icon PinmemberOrgMulle8-Mar-09 22:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140709.1 | Last Updated 6 Dec 2005
Article Copyright 2004 by NSPatel38
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid