[API]
HtmlHelpA
HtmlHelpCloseA
HtmlHelpW
Sleep

[CODE]
Public Function HtmlHelp(ByVal hWnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwdata As Variant) As Long
  Dim xChar1 As String
  Dim xChar2 As String
  Dim xLong1 As Long
  
  If wCommand = &H12& Then
#If DoeventsEx_GetTickCount And DoeventsEx_GetElapsedTime Then
    If Not HtmlHelp_LastCall = 0& Then
      HtmlHelp_LastCall = 1000 - DoeventsEx_GetElapsedTime(HtmlHelp_LastCall)
      If HtmlHelp_LastCall > 0& And HtmlHelp_LastCall < 1000& Then
        Sleep HtmlHelp_LastCall
        End If
      HtmlHelp_LastCall = 0&
#Else
    If HtmlHelp_Active Then
      Sleep 333&
      HtmlHelp_Active = False
#End If
      On Error GoTo Er1
      If IsUnicode Then
        HtmlHelp = HtmlHelpW(0&, 0&, wCommand, ByVal 0&)
        Else
        HtmlHelp = HtmlHelpCloseA(0&, 0&, wCommand, ByVal 0&)
        End If
      On Error GoTo 0
      End If
    Else
    If IsUnicode Then
      xChar1 = String(258&, vbNullChar)
      xLong1 = GetShortPathNameW(StrPtr(lpHelpFile), StrPtr(xChar1), 257&)
      If (xLong1 < 257&) And Not xLong1 = 0& Then lpHelpFile = Left(xChar1, xLong1)
      If VarType(dwdata) = vbString Then
        xChar2 = dwdata
        On Error GoTo Er1
        HtmlHelp = HtmlHelpW(hWnd, StrPtr(lpHelpFile), wCommand, ByVal StrPtr(xChar2))
        Else
        xLong1 = dwdata
        On Error GoTo Er1
        HtmlHelp = HtmlHelpW(hWnd, StrPtr(lpHelpFile), wCommand, ByVal xLong1)
        End If
      On Error GoTo 0
      Else
      If VarType(dwdata) = vbString Then
        xChar2 = dwdata
        On Error GoTo Er1
        HtmlHelp = HtmlHelpA(hWnd, lpHelpFile, wCommand, ByVal xChar2)
        Else
        xLong1 = dwdata
        On Error GoTo Er1
        HtmlHelp = HtmlHelpA(hWnd, lpHelpFile, wCommand, ByVal xLong1)
        End If
      On Error GoTo 0
      End If
    #If DoeventsEx_GetTickCount And DoeventsEx_GetElapsedTime Then
      If Not HtmlHelp_LastCall = 0& Then
        HtmlHelp_LastCall = DoeventsEx_GetTickCount()
        End If
      #Else
      If HtmlHelp Then
        HtmlHelp_Active = True
        End If
      #End If
Rs1:
    End If
  Exit Function
  
Er1:
  Resume Rs1
  End Function