[API]
POINTAPI
MSG
GetMessageA
GetMessageW
IsDialogMessageA
IsDialogMessageW
TranslateMessage
DispatchMessageA
DispatchMessageW
PostQuitMessage
TranslateAcceleratorA
TranslateAcceleratorW

[INCLUDE]
Unicode

[CODE]
Public Sub MessageLoopAccel(ByVal hWnd As Long, ByVal hAccel As Long)
  Dim xMsg As MSG
  Dim xLong1 As Long

  If IsUnicode Then
    xLong1 = GetMessageW(xMsg, 0&, 0&, 0&)
    Do Until (xLong1 = 0&)
      If xLong1 = -1& Then
        ' handle the error and possibly exit
        ElseIf TranslateAcceleratorW(hWnd, hAccel, xMsg) = 0& Then
        If IsDialogMessageW(hWnd, xMsg) = 0& Then
          Call TranslateMessage(xMsg)
          Call DispatchMessageW(xMsg)
          End If
        End If
      xLong1 = GetMessageW(xMsg, 0&, 0&, 0&)
      Loop
    Else
    xLong1 = GetMessageA(xMsg, 0&, 0&, 0&)
    Do Until (xLong1 = 0&)
      If xLong1 = -1& Then
        ' handle the error and possibly exit
        ElseIf TranslateAcceleratorA(hWnd, hAccel, xMsg) = 0& Then
        If IsDialogMessageA(hWnd, xMsg) = 0& Then
          Call TranslateMessage(xMsg)
          Call DispatchMessageA(xMsg)
          End If
        End If
      xLong1 = GetMessageA(xMsg, 0&, 0&, 0&)
      Loop
    End If
  End Sub