USUÁRIO:      SENHA:        SALVAR LOGIN ?    Adicione o VBWEB na sua lista de favoritos   Fale conosco 

 

  Dicas

  Visual Basic    (ActiveX/Controles/DLL)

Título da Dica:  Limpar historio Do internet explorer
Postada em 25/4/2006 por Geronimo            
Para testar crie um form com 1 webbrowser e 2 commandbuttons e cole o seguinte código:

Option Explicit
' clsid: (shlguid.h)  => SHDOCVW.DLL
Private Const clsid_CUrlHistory = "{3C374A40-BAE4-11CF-BF7D-00AA006946EE}"
' clsid: (urlhist.h)  => IUrlHistoryStg2
Private Const clsid_IUrlHistoryStg2 = "{AFA0DC11-C313-11D0-831A-00C04FD5AE38}"
' vtbl:  (urlhist.h)  => IUnknown-Release()
Private Const IUrlHistoryStg2_Release As Long = 8&
' vtbl:  (urlhist.h)  => HRESULT=ClearHistory()
Private Const IUrlHistoryStg2_ClearHistory As Long = 36&
' const: (WTYPES.h)   => ClassContext
Private Const CLSCTX_INPROC_SERVER As Long = 1&
' const: (WINERROR.h)
Private Const S_OK As Long = 0&
' const: (OAIDL.h)    => CallConvention
Private Const CC_STDCALL As Long = 4&
Private Declare Function CLSIDFromString Lib "ole32" (ByVal lpszProgID As Long, ByVal pCLSID As Long) As Long
Private Declare Function CoCreateInstance Lib "ole32" (ByVal rclsid As String, ByVal pUnkOuter As Long, ByVal dwClsContext As Long, ByVal riid As String, ByRef ppv As Long) As Long
Private Declare Sub DispCallFunc Lib "oleaut32" (ByVal ppv As Long, ByVal oVft As Long, ByVal cc As Long, ByVal rtTYP As VbVarType, ByVal paCNT As Long, ByRef paTypes As Long, ByRef paValues As Long, ByRef fuReturn As Variant)

Public Function DeletaHistorico() As Boolean

    Dim oid As String
    Dim iid As String
    Dim ipt As Long
    Dim ret As Variant

    oid = ConverteCLSID(clsid_CUrlHistory)
    iid = ConverteCLSID(clsid_IUrlHistoryStg2)
    
    If CoCreateInstance(oid, 0&, CLSCTX_INPROC_SERVER, iid, ipt) = S_OK Then
        DispCallFunc ipt, IUrlHistoryStg2_ClearHistory, CC_STDCALL, vbLong, 0, 0&, 0&, ret
        DispCallFunc ipt, IUrlHistoryStg2_Release, CC_STDCALL, vbLong, 0, 0&, 0&, ret
        DeletaHistorico = True
    End If
    
End Function

Public Sub MostraHistorico(WB As WebBrowser)

    Dim Reg, PTH As String
    
    Set Reg = CreateObject("WScript.Shell")
    
    PTH = Reg.regread("HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerShell Foldershistory")
    WB.Navigate "file:///" & PTH
    
End Sub

Private Function ConverteCLSID(clsid As String) As String

    Dim B1(15) As Byte
    
    CLSIDFromString StrPtr(clsid), VarPtr(B1(0))
    ConverteCLSID = StrConv(B1, vbUnicode)

End Function

Private Sub Command2_Click()

    DeletaHistorico
    
End Sub

Private Sub Command2_Click()

    hstDelete
    
End Sub

Private Sub Form_Load()

    Me.Caption = "Exemplo de Manuseio do Histórico do IE"
    Command1.Caption = "Atualiza Histórico"
    Command2.Caption = "Deleta Histórico"
    Command1_Click
    
End Sub
 


CyberWEB Network Ltda.    © Copyright 2000-2021   -   Todos os direitos reservados.
Powered by HostingZone - A melhor hospedagem para seu site
Topo da página