Portal:AOL-Files/Articles/History Change: Difference between revisions

From NINA Wiki
Jump to navigation Jump to search
No edit summary
 
(No difference)

Latest revision as of 03:06, 19 June 2021

 
AOL-Files Articles Downloads FDO91

(Originally by AOL-Files staff member Tau)

Purpose: This will add all the items in the history box on the AOL toolbar to a List Box. When the user double clicks one of the items it will be removed from the AOL history box.

Requirements: This code requires a ListBox named lstHistory and a Command Button named cmdOK.

System: Designed with Visual Basic 6.0 to be used with no BAS file on America Online version 4.0 or 5.0

Option Explicit

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessageByNum& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long)
Private Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal CMD As Long) As Long

Private Const CB_GETCOUNT = &H146
Private Const CB_GETLBTEXTLEN = &H149
Private Const CB_GETLBTEXT = &H148
Private Const CB_DELETESTRING = &H144

Private Sub cmdOK_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    Dim AOL&, ToolBar1&, ToolBar2&, ComboBox&, ComboCount&
    Dim Index&, comboLen&, pString$
    AOL = FindWindow("AOL Frame25", vbNullString)
    ToolBar1 = FindWindowEx(AOL, 0, "AOL Toolbar", vbNullString)
    ToolBar2 = FindWindowEx(ToolBar1, 0, "_AOL_Toolbar", vbNullString)
    ComboBox = FindWindowEx(ToolBar2, 0, "_AOL_Combobox", vbNullString)
    ComboCount = SendMessageByNum(ComboBox, CB_GETCOUNT, 0, 0&)
    For Index = 0 To ComboCount&
        comboLen = SendMessageByNum(ComboBox, CB_GETLBTEXTLEN, Index, 0&)
        pString = String(comboLen + 1, Chr(0))
        Call SendMessageByString(ComboBox, CB_GETLBTEXT, Index, pString)
        lstHistory.AddItem pString
    Next Index
    Call EnableWindow(ComboBox, 0)
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    Dim AOL&, ToolBar1&, ToolBar2&, ComboBox&
    AOL = FindWindow("AOL Frame25", vbNullString)
    ToolBar1 = FindWindowEx(AOL, 0, "AOL Toolbar", vbNullString)
    ToolBar2 = FindWindowEx(ToolBar1, 0, "_AOL_Toolbar", vbNullString)
    ComboBox = FindWindowEx(ToolBar2, 0, "_AOL_Combobox", vbNullString)
    Call EnableWindow(ComboBox, 1)
End Sub

Private Sub lstHistory_DblClick()
    Dim vbIndex&, AOL&, ToolBar1&, ToolBar2&, ComboBox&
    vbIndex& = lstHistory.ListIndex
    lstHistory.RemoveItem vbIndex&
    AOL = FindWindow("AOL Frame25", vbNullString)
    ToolBar1 = FindWindowEx(AOL, 0, "AOL Toolbar", vbNullString)
    ToolBar2 = FindWindowEx(ToolBar1, 0, "_AOL_Toolbar", vbNullString)
    ComboBox = FindWindowEx(ToolBar2, 0, "_AOL_Combobox", vbNullString)
    Call EnableWindow(ComboBox, 1)
    Call SendMessageByNum(ComboBox, CB_DELETESTRING, vbIndex, 0&)
    Call EnableWindow(ComboBox, 0)
End Sub