[API]
POINTAPI
RECT
GetDoubleClickTime
CallWindowProcA
SystemParametersInfoA
SystemParametersInfoW
SetTimer
KillTimer
DestroyWindow
GetSysColor
SetBkColor
SetTextColor
DeleteObject
GetClientRect
FillRect
SelectObject
ShowWindow
GetForegroundWindow
GetCursorPos
WindowFromPoint
ChildWindowFromPoint
GetTextExtentPoint32Wide
AdjustWindowRectEx
SetBkMode
MoveToEx
LineTo
CreatePen
GetDC
SetWindowPos
ReleaseDC
DefWindowProcA
DefWindowProcW

[INCLUDE]
TemporaryMemory
LoadCursor
RegisterClassEx
CreateWindowEx
UIntAddUInt
CreateFontIndirectEx
PokeL
SendMessage
DoEventsEx_GetTickCount
DoEventsEx_IsTickCountElapsed
WindowToCursorPos
TextOut

[DIRECTIVE]
ToolTip_MultiForms

[DEFINE]
''''ToolTip_MultiForms ''''!!!!!!!!! required - recommend - currently!
'ToolTip_WithKeyboard
'ToolTip_WithCallback
'ToolTip_OnOverwriteUpdate
'ToolTip_OnOverwriteDefaultIgnore
'ToolTip_CheckMainClient ' recommend!
'ToolTip_CheckStatics

#If GetAPIPopupMenu Then
  Private ToolTip_IsEnabledInt As Boolean
  #End If

Private ToolTip_hFont As Long
Private ToolTip_Collection As Collection
Private ToolTip_Current_hChild As Long
Private ToolTip_Current_Text1 As String
#If ToolTip_WithKeyboard Then
  Private ToolTip_Current_Text2 As String
  #End If
Private ToolTip_Current_Callback As Long
Private ToolTip_Current_CurrentMainHWnd As Long
Private ToolTip_Delay As Long
Private ToolTip_InitTime As Long
Private ToolTip_hWnd As Long
Private ToolTip_Current_Calc_SpHeight As Long
#If ToolTip_WithKeyboard Then
  Private ToolTip_Current_Calc_SpKeyPre As Long
  Private ToolTip_Current_Calc_SpKey As Long
  #End If
Private ToolTip_Current_Calc_TotalWidthX As Long
Private ToolTip_hTimer As Long
#If ToolTip_WithKeyboard Then
  Private ToolTip_KeyShortTT As String
  #End If
Private Const ToolTip_ClassStr As String = "ExtMultiLineToolTip"
Private Const ToolTip_SpaceLeft As Long = 5&
'Private Const ToolTip_SpaceLeftD As Long = ToolTip_SpaceLeft * 2&
Private Const ToolTip_SpaceTop As Long = 3&
Private Const ToolTip_SpaceTopD As Long = ToolTip_SpaceTop * 2&
Private Const ToolTip_Splitter_CR = vbCr
#If ToolTip_WithKeyboard Then
  Private Const ToolTip_Splitter_Tab = vbTab
  #End If
Private Const ToolTip_Splitter_CR2 = ToolTip_Splitter_CR '+ ToolTip_Splitter_CR

Private Const ToolTip_KeepCallback As Long = -1&

#If ToolTip_MultiForms Then
  Private Const ToolTip_OffsetMainHWnd As Long = 1&
  Private Const ToolTip_OffsetCaption As Long = 2&
  #If ToolTip_WithKeyboard And ToolTip_WithCallback Then
    Private Const ToolTip_OffsetKeyboard As Long = 3&
    Private Const ToolTip_OffsetCallback As Long = 4&
    Private Const ToolTip_CollStep As Long = 5&
    #ElseIf ToolTip_WithKeyboard Then
    Private Const ToolTip_OffsetKeyboard As Long = 3&
    Private Const ToolTip_CollStep As Long = 4&
    #ElseIf ToolTip_WithCallback Then
    Private Const ToolTip_OffsetCallback As Long = 3&
    Private Const ToolTip_CollStep As Long = 4&
    #Else
    Private Const ToolTip_CollStep As Long = 3&
    #End If
  #Else
  Private Const ToolTip_OffsetCaption As Long = 1&
  #If ToolTip_WithKeyboard And ToolTip_WithCallback Then
    Private Const ToolTip_OffsetKeyboard As Long = 2&
    Private Const ToolTip_OffsetCallback As Long = 3&
    Private Const ToolTip_CollStep As Long = 4&
    #ElseIf ToolTip_WithKeyboard Then
    Private Const ToolTip_OffsetKeyboard As Long = 2&
    Private Const ToolTip_CollStep As Long = 3&
    #ElseIf ToolTip_WithCallback Then
    Private Const ToolTip_OffsetCallback As Long = 2&
    Private Const ToolTip_CollStep As Long = 3&
    #Else
    Private Const ToolTip_CollStep As Long = 2&
    #End If
  #End If
  ' 0=main, 1=child, 2=text1, 3=text2, 4=callback
Private Const ToolTip_CollStepN As Long = -ToolTip_CollStep
Private Const ToolTip_CollStepX As Long = ToolTip_CollStep - 1&

Public Enum ToolTip_OnOverwriteUpdate
  TTOOU_Hide = 0
  TTOOU_Ignore = 1
  TTOOU_Update = 2
  TTOOU_UpdateNoSizeChange = 3
  End Enum

#If ToolTip_MDI Then
  Private Declare Function MDIFindWindowExAX Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As Long) As Long
  #End If

[CODE]
Public Sub ToolTip_Init(Optional ByVal KeyboardShortCutString As String)
  Dim xType1 As WNDCLASSEX
  
#If ToolTip_WithKeyboard Then
  ToolTip_KeyShortTT = KeyboardShortCutString
  #End If
  
  'Set ToolTip_Collection = New Collection
  ToolTip_Current_hChild = -1&
  
  With xType1
    .Style = &H23&
    .hCursor = LoadCursor(&H7F00&)
    .hbrBackground = 25&
    .ClassName = ToolTip_ClassStr
    Call RegisterClassEx(xType1, AddressOf ToolTip_RedrawProc)
    End With
  ToolTip_hWnd = CreateWindowEx(&H84&, ToolTip_ClassStr, "", &H8E800000, 0&, 0&, 160&, 16&, 0&, 0&, 0&)
  If Not ToolTip_hWnd = 0& Then
    ToolTip_hTimer = SetTimer(ToolTip_hWnd, 0&, 250&, AddressOf ToolTip_TimerProc)
    ToolTip_FontChange
    End If
  End Sub

Private Sub ToolTip_FontChange()
  Dim xLong1 As Long
  Dim xLong2 As Long
  Dim hFontOld As Long
  Dim xChar1 As String
  Dim xType2 As POINTAPI

  ToolTip_Delay = GetDoubleClickTime
  xLong1 = ptrTemp
  If Not ToolTip_hFont = 0& Then
    Call DeleteObject(ToolTip_hFont)
    ToolTip_hFont = 0&
    End If
  
  If IsUnicode Then
    Call PokeL(ptrTemp, 500&)
    If Not SystemParametersInfoW(41&, 500&, ByVal ptrTemp, 0&) = 0& Then
      Call UIntAddUInt(xLong1, 316&)
      ToolTip_hFont = CreateFontIndirectEx(xLong1)
      End If
    Else
    Call PokeL(ptrTemp, 340&)
    If Not SystemParametersInfoA(41&, 340&, ByVal ptrTemp, 0&) = 0& Then
      Call UIntAddUInt(xLong1, 220&)
      ToolTip_hFont = CreateFontIndirectEx(xLong1)
      End If
    End If
  
  xLong1 = GetDC(ToolTip_hWnd)
  If Not xLong1 = 0& Then
    If Not ToolTip_hFont = 0& Then hFontOld = SelectObject(xLong1, ToolTip_hFont)
  
    Call SelectObject(xLong1, ToolTip_hFont)
    #If ToolTip_WithKeyboard Then
      xLong2 = Len(ToolTip_KeyShortTT)
      Call GetTextExtentPoint32Wide(xLong1, StrPtr(ToolTip_KeyShortTT), xLong2, xType2)
      ToolTip_Current_Calc_SpKeyPre = xType2.x + ToolTip_SpaceLeft 'GetTextOutWidth(xLong1, ToolTip_KeyShortTT) + ToolTip_SpaceLeft
      #End If
    xChar1 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
    Call GetTextExtentPoint32Wide(xLong1, StrPtr(xChar1), 62&, xType2)
    ToolTip_Current_Calc_SpHeight = xType2.y

    If Not hFontOld = 0& Then Call SelectObject(xLong1, hFontOld)
    Call ReleaseDC(ToolTip_hWnd, xLong1)
    End If
  End Sub

Private Function ToolTip_TimerProc(ByVal hwnd As Long, ByVal Message As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  Static xBool1 As Boolean
  Dim xType1 As POINTAPI
  Static xType2 As POINTAPI
  #If ToolTip_CheckMainClient Or ToolTip_CheckStatics Then
    Dim xType3 As POINTAPI
    #End If
  Static HasMovedState As Boolean
  Dim xFoundChild As Long
  Dim xLong2 As Long
  Dim xLong3 As Long
  Dim xLong4 As Long

'Stop
  If Not xBool1 Then
    xBool1 = True
    Call GetCursorPos(xType1)
    xLong2 = WindowFromPoint(xType1.x, xType1.y)
    #If ToolTip_CheckMainClient Or ToolTip_CheckStatics Then
      If Not xLong2 = 0& Then
        xType3 = xType1
        If Not ScreenToClient(xLong2, xType3) = 0& Then
          xLong3 = ChildWindowFromPoint(xLong2, xType3.x, xType3.y)
          #If ToolTip_CheckMainClient Then
            If xLong3 = 0& Then
              If GetParent(xLong2) = 0& Then
                xLong2 = 0&
                End If
#If ToolTip_CheckStatics Then
              Else
              xLong2 = xLong3
#End If
              End If
            #Else
            If Not xLong3 = 0& Then
              xLong2 = xLong3
              End If
            #End If
          End If
        End If
      #End If
    xLong4 = GetForegroundWindow
#If ToolTip_MDI Then
    If Not xLong4 = 0& Then
      xLong3 = MDIFindWindowExAX(xLong4, 0&, "MDIClient", 0&)
      If xLong3 = 0& Then
        xLong3 = SendMessage(xLong4, &H229, 0&, 0&)
        Else
        xLong3 = SendMessage(xLong3, &H229, 0&, 0&)
        End If
      If Not xLong3 = 0& Then
        xLong4 = xLong3
        End If
      End If
#End If
    If Not ToolTip_Current_Callback = 0& Then
      If xLong2 = ToolTip_Current_hChild Then
        If xLong4 = ToolTip_Current_CurrentMainHWnd Then
          Call CallWindowProcA(ToolTip_Current_Callback, 0&, 0&, ToolTip_Current_hChild, VarPtr(xType1))
          End If
        End If
      End If
'    If GetForegroundWindow = MainHWnd Then
    If HasMovedState Then
RePossible:
#If ToolTip_SetEnable And GetAPIPopupMenu Then
      If ToolTip_IsEnabled And ToolTip_IsEnabledInt Then
#ElseIf ToolTip_SetEnable Then
      If ToolTip_IsEnabled Then
#ElseIf GetAPIPopupMenu Then
      If ToolTip_IsEnabledInt Then
#End If
        xFoundChild = -1&
        For xLong3 = 1& To ToolTip_Collection.Count - ToolTip_CollStepX Step ToolTip_CollStep
          If CLng(ToolTip_Collection(xLong3)) = xLong2 Then
            If xLong4 = CLng(ToolTip_Collection(xLong3 + 1&)) Then
              ToolTip_Current_Text1 = CStr(ToolTip_Collection(xLong3 + ToolTip_OffsetCaption))
              #If ToolTip_WithKeyboard Then
                ToolTip_Current_Text2 = CStr(ToolTip_Collection(xLong3 + ToolTip_OffsetKeyboard))
                #End If
              #If ToolTip_WithCallback Then
                ToolTip_Current_Callback = CLng(ToolTip_Collection(xLong3 + ToolTip_OffsetCallback))
                #End If
              ToolTip_Current_CurrentMainHWnd = xLong4
              xFoundChild = xLong2
'Debug.Print "RealFound: ", xFoundChild, ToolTip_Current_Text1, ToolTip_Current_Text2
              End If
            Exit For
            End If
          Next
        If xFoundChild = ToolTip_Current_hChild Then
'Debug.Print "Same!"
          If Not ToolTip_Current_hChild = -1& Then
            If ToolTip_InitTime = -1& Then
              If Not (xType1.x = xType2.x And xType1.y = xType2.y) Then
                If ToolTip_Delay = 0& Then
                  ToolTip_CalcRect
                  Else
                  End If
                End If
              Else
              If (xType1.x = xType2.x And xType1.y = xType2.y) Then
                If DoEventsEx_IsTickCountElapsed(ToolTip_InitTime, ToolTip_Delay) Then
ShowNow:
                  ToolTip_InitTime = -1&
                  ToolTip_CalcRect
                  ShowWindow ToolTip_hWnd, 4&
                  End If
                Else
                GoTo ReSetTTime
                End If
              End If
            End If
          Else
          ToolTip_Current_hChild = xFoundChild
          If ToolTip_Current_hChild = -1& Then
HideOld:
            If ToolTip_InitTime = -1& Then ShowWindow ToolTip_hWnd, 0&
            Else
            If ToolTip_Delay = 0& Then
              ShowWindow ToolTip_hWnd, 0&
              GoTo ShowNow
              Else
ReSetTT:
              If ToolTip_InitTime = -1& Then ShowWindow ToolTip_hWnd, 0&
ReSetTTime:
              ToolTip_InitTime = DoEventsEx_GetTickCount
              End If
            End If
          End If
#If ToolTip_SetEnable Or GetAPIPopupMenu Then
        ElseIf Not ToolTip_Current_hChild = -1& Then
'HideAll:
        ToolTip_Current_hChild = -1&
        GoTo HideOld
        End If
#End If
      ElseIf Not (xType1.x = xType2.x And xType1.y = xType2.y) Then
      HasMovedState = True
      GoTo RePossible
      End If
      'ElseIf HasMovedState Then
      'HasMovedState = False
      'GoTo HideAll
      'End If
    xType2.x = xType1.x
    xType2.y = xType1.y
    xBool1 = False
    End If
  End Function

Private Sub ToolTip_CalcRect()
  Dim xLong1 As Long
  Dim xLong2 As Long
  Dim xLong3 As Long
  Dim xChar1 As String
  Dim xType1 As POINTAPI
  Dim xType2 As POINTAPI
  Dim xType3 As RECT
  Dim xCount As Long
  Dim hdc As Long
  Dim hFontOld As Long
  
  hdc = GetDC(ToolTip_hWnd)
  If Not hdc = 0& Then
    If Not ToolTip_hFont = 0& Then hFontOld = SelectObject(hdc, ToolTip_hFont)
    
    
    xChar1 = ToolTip_Current_Text1 + ToolTip_Splitter_CR
    Call SelectObject(hdc, ToolTip_hFont)
    Do
      xLong1 = InStr(xChar1, ToolTip_Splitter_CR)
      If xLong1 = 0& Then
        Exit Do
        Else
        If xCount = 1& Then xType3.Bottom = xType3.Bottom + 5&
        xCount = xCount + 1&
        Call GetTextExtentPoint32Wide(hdc, StrPtr(xChar1), xLong1 - 1&, xType1)
        If xType1.x > xType3.Right Then xType3.Right = xType1.x
        xType3.Bottom = xType3.Bottom + ToolTip_Current_Calc_SpHeight
        xChar1 = Mid(xChar1, xLong1 + 1&)
        End If
      Loop
    xType3.Right = xType3.Right + ToolTip_SpaceLeft
    
    #If ToolTip_WithKeyboard Then
      ToolTip_Current_Calc_SpKey = 0&
      If Not Len(ToolTip_Current_Text2) = 0& Then
        'If xCount < 2& Then xType3.Bottom = xType3.Bottom + 5&
        xType3.Bottom = xType3.Bottom + 4&
        
        xChar1 = ToolTip_Current_Text2 + ToolTip_Splitter_CR2
        If InStr(xChar1, vbTab) = 0& Then xChar1 = vbTab + xChar1
        Do
          xLong1 = InStr(xChar1, ToolTip_Splitter_Tab)
          xLong2 = InStr(xChar1, ToolTip_Splitter_CR)
          If xLong1 = 0& Or xLong2 = 0& Or xLong1 > xLong2 Then
            Exit Do
            Else
            Call GetTextExtentPoint32Wide(hdc, StrPtr(xChar1), xLong1 - 1&, xType1)
            If xType1.x > ToolTip_Current_Calc_SpKey Then ToolTip_Current_Calc_SpKey = xType1.x
            xChar1 = Mid(xChar1, xLong1 + 1&)
            Call GetTextExtentPoint32Wide(hdc, StrPtr(xChar1), xLong2 - xLong1 - 1&, xType1)
            If xType1.x > xLong3 Then xLong3 = xType1.x
            xType3.Bottom = xType3.Bottom + ToolTip_Current_Calc_SpHeight
            xChar1 = Mid(xChar1, xLong2 - xLong1 + 1&)
            End If
          Loop
        ToolTip_Current_Calc_SpKey = ToolTip_Current_Calc_SpKeyPre + ToolTip_Current_Calc_SpKey '+ ToolTip_SpaceLeft
        xLong3 = xLong3 + ToolTip_Current_Calc_SpKey '+ToolTip_Current_Calc_SpKeyPre
        If xLong3 > xType3.Right Then xType3.Right = xLong3
        End If
      #End If
    
    xType3.Right = xType3.Right + ToolTip_SpaceLeft
    ToolTip_Current_Calc_TotalWidthX = xType3.Right
    xType3.Bottom = xType3.Bottom + ToolTip_SpaceTopD
    Call AdjustWindowRectEx(xType3, &H8E800000, 0&, &H84&)
    xType1.x = xType3.Right - xType3.Left
    xType1.y = xType3.Bottom - xType3.Top
    'GetTextOutWidth = sPointApi.x
    
    Call WindowToCursorPos(xType1, xType2)
    
    Call SetWindowPos(ToolTip_hWnd, -2&, 0&, 0&, 0&, 0&, &H213&)
    Call SetWindowPos(ToolTip_hWnd, -1&, 0&, 0&, 0&, 0&, &H213&)
    Call SetWindowPos(ToolTip_hWnd, 0&, xType2.x, xType2.y, xType1.x, xType1.y, &H214&)
  
    If Not hFontOld = 0& Then Call SelectObject(hdc, hFontOld)
    Call ReleaseDC(ToolTip_hWnd, hdc)
    End If
  End Sub

Private Sub ToolTip_Draw()
  Dim xLong1 As Long
  Dim xLong2 As Long
  Dim xLong3 As Long
  Dim xLong4 As Long
  Dim xLong5 As Long
  Dim xChar1 As String
  Dim xhPen As Long
  Dim xhPenOld As Long
  Dim xCount As Long
  
  'If ToolTip_InitTime = -1& And Not ToolTip_Current_hChild = -1& Then
    xLong1 = GetDC(ToolTip_hWnd)
    If Not xLong1 = 0& Then
      xLong5 = SelectObject(xLong1, ToolTip_hFont)
      Call SetBkColor(xLong1, GetSysColor(24&))
      Call SetTextColor(xLong1, GetSysColor(23&))
      Call SetBkMode(xLong1, 1&)

      xLong4 = ToolTip_SpaceTop
      
      xChar1 = ToolTip_Current_Text1 + ToolTip_Splitter_CR
      Do
'Stop
        xLong2 = InStr(xChar1, ToolTip_Splitter_CR)
        If xLong2 = 0& Then
          Exit Do
          Else
          If xCount = 1& Then GoSub AddLine
          xCount = xCount + 1&
          Call TextOut(xLong1, Left(xChar1, xLong2 - 1&), ToolTip_SpaceLeft, xLong4)
          xLong4 = xLong4 + ToolTip_Current_Calc_SpHeight
          xChar1 = Mid(xChar1, xLong2 + 1&)
          End If
        Loop
  
      #If ToolTip_WithKeyboard Then
        If Not Len(ToolTip_Current_Text2) = 0& Then
          'If xCount < 2& Then GoSub AddLine
          xLong4 = xLong4 + 4&
          
          Call TextOut(xLong1, ToolTip_KeyShortTT, ToolTip_SpaceLeft, xLong4)
          
          xChar1 = ToolTip_Current_Text2 + ToolTip_Splitter_CR '2
          If InStr(xChar1, vbTab) = 0& Then xChar1 = vbTab + xChar1
          Do
            xLong2 = InStr(xChar1, ToolTip_Splitter_Tab)
            xLong3 = InStr(xChar1, ToolTip_Splitter_CR)
            If xLong2 = 0& Or xLong3 = 0& Or xLong2 > xLong3 Then
              Exit Do
              Else
              If xLong2 = 0& Then xLong3 = xLong2: xLong2 = Len(xChar1)
              Call TextOut(xLong1, Left(xChar1, xLong2 - 1&), ToolTip_Current_Calc_SpKeyPre, xLong4)
              Call TextOut(xLong1, Mid(xChar1, xLong2 + 1&, xLong3 - xLong2 - 1&), ToolTip_Current_Calc_SpKey, xLong4)
              xLong4 = xLong4 + ToolTip_Current_Calc_SpHeight
              xChar1 = Mid(xChar1, xLong3 + 1&)
              End If
            Loop
          End If
        #End If
      Call SelectObject(xLong1, xLong5)
      Call ReleaseDC(ToolTip_hWnd, xLong1)
      End If
'    End If
  GoTo LblEndSub
  
AddLine:
  xLong4 = xLong4 + 2&
'Debug.Print "AddLine:", xLong4
  Call MoveToEx(xLong1, 1&, xLong4, 0&)
  xhPen = CreatePen(0&, 0&, GetSysColor(23&))
  If Not xhPen = 0& Then
    xhPenOld = SelectObject(xLong1, xhPen)
    Call LineTo(xLong1, ToolTip_Current_Calc_TotalWidthX, xLong4)
    Call SelectObject(xLong1, xhPenOld)
    Call DeleteObject(xhPen)
    End If
  xLong4 = xLong4 + 3&
  Return

LblEndSub:
  End Sub

Private Sub ToolTip_EraseBackground()
  Dim xLong1 As Long
  Dim xType1 As RECT
  
  xLong1 = GetDC(ToolTip_hWnd)
  If Not xLong1 = 0& Then
    Call GetClientRect(ToolTip_hWnd, xType1)
    Call FillRect(xLong1, xType1, 25&)
    Call ReleaseDC(ToolTip_hWnd, xLong1)
    End If
  End Sub

Private Function ToolTip_RedrawProc(ByVal hwnd As Long, ByVal Message As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  If IsUnicode Then
    ToolTip_RedrawProc = DefWindowProcW(hwnd, Message, wParam, lParam)
    Else
    ToolTip_RedrawProc = DefWindowProcA(hwnd, Message, wParam, lParam)
    End If
  If Message = &HF& Then
    If ToolTip_InitTime = -1& And Not ToolTip_Current_hChild = -1& Then ToolTip_Draw
    ElseIf Message = &H15& Then
    'syscolorchange
    ToolTip_FontChange
    End If
  End Function

Public Sub ToolTip_Set(ByVal hWndMain As Long, ByVal hWndChild As Long, ByVal Text1 As String, Optional ByVal Text2 As String, Optional ByVal CallBackProc As Long = ToolTip_KeepCallback, Optional ByVal OnOverwriteUpdate As ToolTip_OnOverwriteUpdate = TTOOU_Hide)
  Dim xLong1 As Long
  Dim xLong2 As Long

  For xLong1 = ToolTip_Collection.Count - ToolTip_CollStepX To 1& Step ToolTip_CollStepN
    If CLng(ToolTip_Collection(xLong1)) = hWndChild Then
      #If ToolTip_WithCallback Then
        If CallBackProc = ToolTip_KeepCallback Then CallBackProc = CLng(ToolTip_Collection(xLong1 + ToolTip_OffsetCallback))
        #End If
#If ToolTip_WithKeyboard And ToolTip_WithCallback Then
      If Not (Clng(ToolTip_Collection(xLong1 + ToolTip_OffsetMainHWnd)) = hWndMain And CStr(ToolTip_Collection(xLong1 + ToolTip_OffsetCaption)) = Text1 And CStr(ToolTip_Collection(xLong1 + ToolTip_OffsetKeyboard)) = Text2 And CLng(ToolTip_Collection(xLong1 + ToolTip_OffsetCallback)) = CallBackProc) Then
#ElseIf ToolTip_WithKeyboard Then
      If Not (Clng(ToolTip_Collection(xLong1 + ToolTip_OffsetMainHWnd)) = hWndMain And CStr(ToolTip_Collection(xLong1 + ToolTip_OffsetCaption)) = Text1 And CStr(ToolTip_Collection(xLong1 + ToolTip_OffsetKeyboard)) = Text2) Then
#ElseIf ToolTip_WithCallback Then
      If Not (Clng(ToolTip_Collection(xLong1 + ToolTip_OffsetMainHWnd)) = hWndMain And CStr(ToolTip_Collection(xLong1 + ToolTip_OffsetCaption)) = Text1 And CLng(ToolTip_Collection(xLong1 + ToolTip_OffsetCallback)) = CallBackProc) Then
#Else
      If Not (Clng(ToolTip_Collection(xLong1 + ToolTip_OffsetMainHWnd)) = hWndMain And CStr(ToolTip_Collection(xLong1 + ToolTip_OffsetCaption)) = Text1) Then
#End If
        
        
        
        For xLong2 = 0& To ToolTip_CollStepX
          ToolTip_Collection.Remove xLong1
          Next
'Debug.Print "      RemoveToAdd"
        Exit For
        End If
'Debug.Print "      Keep"
      GoTo FoundTT
      End If
    Next
  
  If CallBackProc = ToolTip_KeepCallback Then CallBackProc = 0&
'Debug.Print "Adding"
  ToolTip_Collection.Add hWndChild
  #If ToolTip_MultiForms Then
    ToolTip_Collection.Add hWndMain
    #End If
  ToolTip_Collection.Add Text1
  #If ToolTip_WithKeyboard Then
    ToolTip_Collection.Add Text2
    #End If
  #If ToolTip_WithCallback Then
    ToolTip_Collection.Add CallBackProc
    #End If
  #If Not ToolTip_OnOverwriteDefaultIgnore Then
    If Not xLong2 = 0& Then
      If ToolTip_Current_hChild = hWndChild Then
  #If ToolTip_OnOverwriteUpdate Then
        Select Case OnOverwriteUpdate
          Case ToolTip_OnOverwriteUpdate.TTOOU_Hide
  #End If
            ToolTip_Current_hChild = -1&
            If ToolTip_InitTime = -1& Then
              ShowWindow ToolTip_hWnd, 0&
              End If
  #If ToolTip_OnOverwriteUpdate Then
  '        Case ToolTip_OnOverwriteUpdate.TTOOU_Ignore
          Case ToolTip_OnOverwriteUpdate.TTOOU_Update
            If ToolTip_InitTime = -1& Then
              ToolTip_Current_Text1 = Text1
              #If ToolTip_WithKeyboard Then
                ToolTip_Current_Text2 = Text2
                #End If
              #If ToolTip_WithCallback Then
                ToolTip_Current_Callback = CallBackProc
                #End If
              Call ToolTip_CalcRect
              Call ToolTip_EraseBackground
              Call ToolTip_Draw
              End If
          Case ToolTip_OnOverwriteUpdate.TTOOU_UpdateNoSizeChange
            If ToolTip_InitTime = -1& Then
              ToolTip_Current_Text1 = Text1
              #If ToolTip_WithKeyboard Then
                ToolTip_Current_Text2 = Text2
                #End If
              #If ToolTip_WithCallback Then
                ToolTip_Current_Callback = CallBackProc
                #End If
              'Call ToolTip_CalcRect
              Call ToolTip_EraseBackground
              Call ToolTip_Draw
              End If
          End Select
  #End If
        End If
      End If
    #End If
FoundTT:
  End Sub

#If GetAPIPopupMenu Then
  Public Sub ToolTip_DisableInt()
    ToolTip_IsEnabledInt = False
    If Not ToolTip_Current_hChild = -1& Then
      ToolTip_Current_hChild = -1&
      If ToolTip_InitTime = -1& Then ShowWindow ToolTip_hWnd, 0&
      End If
    End Sub
  #End If

Public Sub ToolTip_Release()
  Call KillTimer(ToolTip_hTimer, 0&)
  Call DestroyWindow(ToolTip_hWnd)
  If Not ToolTip_hFont = 0& Then
    Call DeleteObject(ToolTip_hFont)
    ToolTip_hFont = 0&
    End If
  Call UnregisterClass(ToolTip_ClassStr)
  End Sub
