[API]
GetDlgItem
SetFocusAPI
LocalAlloc
LocalFree
RtlMoveMemory
EndDialog
DestroyIcon
SendMessageA

[INCLUDE]
HyperlinkList
DialogBoxIndirectParam
LoadResEx_Icon
HookWindow
UnhookWindow
CallFunctionFast2
HyperlinkList_GetURLPointerFromItem

[DEFINE]
Private Type HyperLinkList_InfoDialog_Data
  IconID As Long
  hIcon As Long
  CallBack As Long
  HListID As Long
  'FocusID As Long
  CallURL As Long
  End Type
Private Const HyperLinkList_InfoDialog_DataLen As Long = 20& ' 24&

[CODE]
Public Sub HyperLinkList_InfoDialog(ByVal ResID As Long, ByVal InitCallback As Long, ByVal hWndParent As Long, Optional Byval URLHandler As Long, Optional ByVal IconID As Long, Optional Byval ListID As Long = 5&, Optional Byval FocusID As Long = 9&)
  Dim xLong1 As Long
  Dim xType1 As HyperLinkList_InfoDialog_Data
  
  If Not InitCallback = 0& Then
    With xType1
      .IconID = IconID
      .CallBack = InitCallback
      .HListID = ListID
      '.FocusID = FocusID
      .CallURL = URLHandler
      End With
  
    xLong1 = LocalAlloc(0&, HyperLinkList_InfoDialog_DataLen)
    If Not xLong1 = 0& Then
      Call RtlMoveMemory(ByVal xLong1, xType1, HyperLinkList_InfoDialog_DataLen)
      #If InIDE Then
        #If LoadResEx_SetThemeFile Then
          Call DialogBoxIndirectParam(ResID, hWndParent, AddressOf HyperLinkList_InfoDialog_Proc, xLong1, LoadResEx_ThemeFile_hModule)
          #ElseIf LoadResEx_SetLanguageFile Then
          Call DialogBoxIndirectParam(ResID, hWndParent, AddressOf HyperLinkList_InfoDialog_Proc, xLong1, LoadResEx_LanguageFile_hModule)
          #Else
          Call DialogBoxIndirectParam(ResID, hWndParent, AddressOf HyperLinkList_InfoDialog_Proc, xLong1)
          #End If
        #Else
        Call DialogBoxIndirectParam(ResID, hWndParent, AddressOf HyperLinkList_InfoDialog_Proc, xLong1)
        #End If
      Call LocalFree(xLong1)
      End If
    End If
  End Sub

Private Function HyperLinkList_InfoDialog_Init(ByVal HWndDialog As Long, ByVal lParam As Long) As Long
  Dim xLong1 As Long
  Dim xType1 As HyperLinkList_InfoDialog_Data
  
  If Not lParam = 0& Then
    Call RtlMoveMemory(xType1, ByVal lParam, HyperLinkList_InfoDialog_DataLen)
    xLong1 = GetDlgItem(HWndDialog, xType1.HListID)
    If Not xLong1 = 0& Then
      If Not xType1.IconID = 0& Then
        xType1.hIcon = LoadResEx_Icon(xType1.IconID)
        End If
      Call HookWindow(xLong1, AddressOf HyperlinkList_Proc)
      Call CallFunctionFast2(xType1.CallBack, xLong1, xType1.hIcon)
      End If
    'xLong1 = GetDlgItem(HWndDialog, xType1.FocusID)
    'If Not xLong1 = 0& Then
    '  Call SetFocusAPI(xLong1)
    '  Else
    '  HyperLinkList_InfoDialog_Init = 1&
    '  End If
    Call RtlMoveMemory(ByVal lParam, xType1, HyperLinkList_InfoDialog_DataLen)
    Call SetWindowLong(HWndDialog, -21&, lParam)
    End If
  End Function

Private Sub HyperLinkList_InfoDialog_Destroy(ByVal HWndDialog As Long)
  Dim xLong1 As Long
  Dim xType1 As HyperLinkList_InfoDialog_Data
  
  xLong1 = GetWindowLong(HWndDialog, -21&)
  If Not xLong1 = 0& Then
    Call RtlMoveMemory(xType1, ByVal xLong1, HyperLinkList_InfoDialog_DataLen)
    xLong1 = GetDlgItem(HWndDialog, xType1.HListID)
    If Not xLong1 = 0& Then
      Call UnhookWindow(xLong1)
      End If
    If Not xType1.hIcon = 0& Then
      Call DestroyIcon(xType1.hIcon)
      End If
    End If
  End Sub

Private Sub HyperLinkList_InfoDialog_OpenURL(ByVal HWndDialog As Long, ByVal hwnd As Long)
  Dim xLong1 As Long
  'Dim xChar1 As String
  Dim xType1 As HyperLinkList_InfoDialog_Data

  If Not hWnd = 0& Then
    xLong1 = GetWindowLong(HWndDialog, -21&)
    If Not xLong1 = 0& Then
      Call RtlMoveMemory(xType1, ByVal xLong1, HyperLinkList_InfoDialog_DataLen)
      If Not xType1.CallURL = 0& then
        xLong1 = SendMessageA(hWnd, &H19F&, 0&, ByVal 0&)
        If xLong1 >= 0& Then
          xLong1 = HyperlinkList_GetURLPointerFromItem(hWnd, xLong1)
          If Not Len(xLong1) = 0& Then
            Call CallFunctionFast2(xType1.CallURL, HWndDialog, xLong1)
            'Call ShellExecute(HWndDialog, "Open", xChar1, "", "", 5&)
            'Clipboard.Clear
            'Clipboard.SetText xChar1, Text
            End If
          End If
        End If
      End If
    End If
  End Sub

Private Function HyperLinkList_InfoDialog_GetListDlgID(ByVal HWndDialog As Long) As Long
  Dim xLong1 As Long
  Dim xType1 As HyperLinkList_InfoDialog_Data
  
  xLong1 = GetWindowLong(HWndDialog, -21&)
  If Not xLong1 = 0& Then
    Call RtlMoveMemory(xType1, ByVal xLong1, HyperLinkList_InfoDialog_DataLen)
    HyperLinkList_InfoDialog_GetListDlgID = xType1.HListID
    End If
  End Function

Private Function HyperLinkList_InfoDialog_Proc(ByVal HWndDialog As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  Select Case Msg
    Case &H2B& ' WM_DRAWITEM
      HyperLinkList_InfoDialog_Proc = HyperlinkList_WM_DRAWITEM(lParam)
      Exit Function
    Case &H110& 'WM_INITDIALOG
      HyperLinkList_InfoDialog_Proc = HyperLinkList_InfoDialog_Init(HWndDialog, lParam)
      Exit Function
    Case &H111& 'WM_COMMAND
      If lParam = 0& Then
        If wParam = 2& Then
          Call EndDialog(HWndDialog, 0&)
          End If
        ElseIf (GetWindowLong(lParam, -16&) And &HE&) = 0& Then
        If (wParam And &HFFFF&) = HyperLinkList_InfoDialog_GetListDlgID(HWndDialog) Then
          If (wParam And &HFFFF0000) = &H20000 Then
            Call HyperLinkList_InfoDialog_OpenURL(HWndDialog, lParam)
            End If
          Else
          Call EndDialog(HWndDialog, 0&)
          End If
        End If
    Case &H10& 'WM_CLOSE
      Call EndDialog(HWndDialog, 0&)
    Case &H2& 'WM_DESTROY
      HyperLinkList_InfoDialog_Destroy (HWndDialog)
    Case &H2C& ' WM_MEASUREITEM
      HyperLinkList_InfoDialog_Proc = HyperlinkList_WM_MEASUREITEM(lParam)
      Exit Function
    Case &H2D& ' WM_DELETEITEM
      HyperLinkList_InfoDialog_Proc = HyperlinkList_WM_DELETEITEM(lParam)
      Exit Function
    End Select
  'HyperLinkList_InfoDialog_Proc = HookedWindowProc(hwnd, Msg, wParam, lParam)
  End Function

