Hi All
Can anyone pls help me convert the following VB.NET code to C#.
This uses MSHTML and an Interface definition.
Thanks
NG
Option Explicit On
Option Strict On
Imports System.Runtime.InteropServices
<ComVisible(True), ComImport(),
Guid("7FD52380-4E07-101B-AE2D-08002B2EC713"), _
InterfaceTypeAttribute(ComInterfaceType.InterfaceI sIUnknown)> _
Public Interface IPersistStreamInit
' IPersist interface
Sub GetClassID(ByRef pClassID As Guid)
<PreserveSig()> Function IsDirty() As Integer
<PreserveSig()> Function Load(ByVal pstm As UCOMIStream) As Integer
<PreserveSig()> Function Save(ByVal pstm As UCOMIStream, ByVal
ByValfClearDirty As Boolean) As Integer
<PreserveSig()> Function GetSizeMax(<InAttribute(), Out(),
MarshalAs(UnmanagedType.U8)> ByRef pcbSize As Long) As Integer
<PreserveSig()> Function InitNew() As Integer
End Interface
Imports System.Windows.Forms
Public Class dom_lib
Public Function Fun() As String
Dim objMSHTML As mshtml.HTMLDocument
Dim objDocument As mshtml.IHTMLDocument2
Dim ips As IPersistStreamInit
objMSHTML = New mshtml.HTMLDocument
ips = DirectCast(objMSHTML, IPersistStreamInit)
ips.InitNew()
objDocument =
objMSHTML.createDocumentFromUrl("http://microsoft.com/", String.Empty)
Do Until objDocument.readyState = "complete"
Application.DoEvents()
Loop
Fun = objDocument.body.outerHTML
End Function
End Class