- 題名: WebBrowser の履歴&キャッシュの削除
- 日時: 2006/05/22 15:41:44
- ID: 15894
- この記事の返信元:
- (なし)
- この記事への返信:
- [15899] Re[1]: WebBrowser の履歴&キャッシュの削除2006/05/22 18:12:03
- ツリーを表示
> ところが、これを VB.NET に書き換えることがどうにも...できません。 とりあえず、VB2005 なコンソールアプリとして書いてみました。 Imports System.Runtime.InteropServices Public Module Module1 Public Sub Main() Dim H As New UrlHistoryImpl() H.ClearHistory() If Marshal.IsComObject(H) Then Marshal.ReleaseComObject(H) End If End Sub <ComImport(), Guid("3C374A40-BAE4-11CF-BF7D-00AA006946EE")> _ Public Class UrlHistoryImpl Implements IUrlHistoryStg2 Public Sub AddUrl(ByVal pocsUrl As String, ByVal pocsTitle As String, ByVal dwFlags As UInteger) Implements IUrlHistoryStg.AddUrl, IUrlHistoryStg2.AddUrl End Sub Public Sub BindToObject(ByVal pocsUrl As String, ByRef riid As System.Guid, ByRef ppvOut As Object) Implements IUrlHistoryStg.BindToObject, IUrlHistoryStg2.BindToObject End Sub Public Sub DeleteUrl(ByVal pocsUrl As String, ByVal dwFlags As UInteger) Implements IUrlHistoryStg.DeleteUrl, IUrlHistoryStg2.DeleteUrl End Sub Public Function EnumUrls() As IEnumSTATURL Implements IUrlHistoryStg.EnumUrls, IUrlHistoryStg2.EnumUrls End Function Public Sub QueryUrl(ByVal pocsUrl As String, ByVal dwFlags As UInteger, ByRef lpSTATURL As STATURL) Implements IUrlHistoryStg.QueryUrl, IUrlHistoryStg2.QueryUrl End Sub Public Sub AddUrlAndNotify(ByVal pocsUrl As String, ByVal pocsTitle As String, ByVal dwFlags As UInteger, ByVal fWriteHistory As Boolean, ByVal poctNotify As Object, ByVal punkISFolder As Object) Implements IUrlHistoryStg2.AddUrlAndNotify End Sub Public Sub ClearHistory() Implements IUrlHistoryStg2.ClearHistory End Sub End Class Public Structure STATURL Public Shared SIZEOF_STATURL As UInteger = CUInt(Marshal.SizeOf(GetType(STATURL))) Public cbSize As UInteger <MarshalAs(UnmanagedType.LPWStr)> Public pwcsUrl As String <MarshalAs(UnmanagedType.LPWStr)> Public pwcsTitle As String Public ftLastVisited, ftLastUpdated, ftExpires As ComTypes.FILETIME Public dwFlags As UInteger End Structure <ComImport(), Guid("3C374A42-BAE4-11CF-BF7D-00AA006946EE"), _ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _ Public Interface IEnumSTATURL <PreserveSig()> Function [Next]( _ ByVal celt As UInteger, _ <Out()> ByVal rgelt As STATURL, _ <Out()> ByVal pceltFetched As UInteger _ ) As UInteger Sub Skip( _ ByVal celt As UInteger _ ) Sub Reset() Sub Clone( _ <Out()> ByVal ppenum As IEnumSTATURL _ ) Sub SetFilter( _ <MarshalAs(UnmanagedType.LPWStr)> ByVal poszFilter As String, _ ByVal dwFlags As UInteger _ ) End Interface <ComImport(), Guid("3C374A41-BAE4-11CF-BF7D-00AA006946EE"), _ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _ Public Interface IUrlHistoryStg Sub AddUrl( _ <MarshalAs(UnmanagedType.LPWStr)> ByVal pocsUrl As String, _ <MarshalAs(UnmanagedType.LPWStr)> ByVal pocsTitle As String, _ ByVal dwFlags As UInteger _ ) Sub DeleteUrl( _ <MarshalAs(UnmanagedType.LPWStr)> ByVal pocsUrl As String, _ ByVal dwFlags As UInteger _ ) Sub QueryUrl( _ <MarshalAs(UnmanagedType.LPWStr)> ByVal pocsUrl As String, _ ByVal dwFlags As UInteger, _ ByRef lpSTATURL As STATURL _ ) Sub BindToObject( _ <MarshalAs(UnmanagedType.LPWStr)> ByVal pocsUrl As String, _ <[In]()> ByRef riid As Guid, _ <Out(), MarshalAs(UnmanagedType.IUnknown)> ByRef ppvOut As Object _ ) Function EnumUrls() As IEnumSTATURL End Interface <ComImport(), Guid("AFA0DC11-C313-11D0-831A-00C04FD5AE38"), _ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _ Public Interface IUrlHistoryStg2 Inherits IUrlHistoryStg #Region " IUrlHistoryStg のメソッド" Shadows Sub AddUrl( _ <MarshalAs(UnmanagedType.LPWStr)> ByVal pocsUrl As String, _ <MarshalAs(UnmanagedType.LPWStr)> ByVal pocsTitle As String, _ ByVal dwFlags As UInteger _ ) Shadows Sub DeleteUrl( _ <MarshalAs(UnmanagedType.LPWStr)> ByVal pocsUrl As String, _ ByVal dwFlags As UInteger _ ) Shadows Sub QueryUrl( _ <MarshalAs(UnmanagedType.LPWStr)> ByVal pocsUrl As String, _ ByVal dwFlags As UInteger, _ ByRef lpSTATURL As STATURL _ ) Shadows Sub BindToObject( _ <MarshalAs(UnmanagedType.LPWStr)> ByVal pocsUrl As String, _ <[In]()> ByRef riid As Guid, _ <Out(), MarshalAs(UnmanagedType.IUnknown)> ByRef ppvOut As Object _ ) Shadows Function EnumUrls() As IEnumSTATURL #End Region Sub AddUrlAndNotify( _ <MarshalAs(UnmanagedType.LPWStr)> ByVal pocsUrl As String, _ <MarshalAs(UnmanagedType.LPWStr)> ByVal pocsTitle As String, _ ByVal dwFlags As UInteger, _ <MarshalAs(UnmanagedType.Bool)> ByVal fWriteHistory As Boolean, _ <MarshalAs(UnmanagedType.IUnknown)> ByVal poctNotify As Object, _ <MarshalAs(UnmanagedType.IUnknown)> ByVal punkISFolder As Object _ ) Sub ClearHistory() End Interface End Module
分類:[.NET]
お世話になります。
VisualBasic.NET で、WebBrowser をつかってブラウザをつくっています。
InternetExplorer のインターネットオプションにある
「履歴のクリア」と「キャッシュのクリア」のボタンをつけたいとおもっています。
ヘルプにはキャッシュについて、
「WebBrowser コントロールは、最近訪れたサイトの Web ページをローカル ハード ディスク上のキャッシュに格納します。ページごとに、キャッシュ内で存続できる時間を示す有効期限を指定できます。」
とありましたが、どのようにしたらよいかわかりません。
ご教授いただけたらさいわいです。