By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,168 Members | 2,599 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,168 IT Pros & Developers. It's quick & easy.

mime filter in vb.net

P: n/a
Hello, how can I create a temporary mime filter for IE in vb.net (or
c#)?
I know i have to use IInternetSession and other interfaces in
urlmon.dll.
I tried to convert some C++ code to VB but i receive several access
violation exceptions:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
'CComPtr<IInternetSessionm_spSession ;
Dim m_spSession As UrlMon.IInternetSession
'CComPtr<IClassFactory m_spClassFactoryMime ;
Dim m_spClassFactoryMime As UrlMon.IClassFactory
'hr = ::CoGetClassObject( CLSID_MimeFilter, CLSCTX_SERVER,
' NULL,
IID_IClassFactory,
' (void**)&m_spClassFactoryMime );
m_spClassFactoryMime =
CoGetClassObject(GetStdGUID("FC3BAAF1-AD41-4141-BC28-5167E29E3B14"),
CLSCTX.CLSCTX_SERVER, _
IntPtr.Zero,
GetStdGUID("00000001-0000-0000-C000-000000000046"))
'if( hr == S_OK )
'{
' if( ::CoInternetGetSession( 0, &m_spSession, 0)
==S_OK )
CoInternetGetSession(0, m_spSession, 0)
' {
'
m_spSession->RegisterMimeFilter(m_spClassFactoryMime,
'
CLSID_MimeFilter,
' L"text/html" );
m_spSession.RegisterMimeFilter(m_spClassFactoryMim e, New
Guid("FC3BAAF1-AD41-4141-BC28-5167E29E3B14"), "text/html")
' }
'}
Me.AxWebBrowser1.Navigate("http://gouki/alieni.htm")
End Sub

CoGetClassObject generates the access violation exception...
Any idea or example?

Nov 13 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.