Public Class MHTML Public cDirectory As String = "" Public cFile As String = "" Public cLicenseKey As String = "" Public cMessage As String = "" Public cUrl As String = "" Private oApp As App = Nothing Private oProcess As LXProcess = Nothing ' This is when we access the class in a desktop mode Sub New(ByVal toApplication As App) oApp = toApplication End Sub ' This is when we access the class in a Web or Web Service mode Public Sub New(ByVal toProcess As LXProcess) oProcess = toProcess oApp = oProcess.oApp End Sub ' Get the MHTML file Public Function GetMHTML() As Boolean Dim lcDirectory As String = "" Dim lcFile As String = "" Dim lcLicenseKey As String = "" Dim llSuccess As Boolean = False Dim loMHT As aspNetMHT.MHT = Nothing ' Reset the values cMessage = "" ' Initialization lcFile = Trim(cFile) lcLicenseKey = Trim(cLicenseKey) ' Initialization lcDirectory = oApp.GetPath(cDirectory) ' Initialization aspNetMHT.MHT.LoadLicenseKey(lcLicenseKey) ' Load the Url loMHT = New aspNetMHT.MHT(cUrl) ' Parse the HTML into its MHT counterpart loMHT.Parse() ' Save it to a file loMHT.SaveToFile(lcDirectory + lcFile) llSuccess = True ' Reset the values cLicenseKey = "" Return llSuccess End Function End ClassThen, from a client application:
Dim loMHTML As Framework.MHTML = New Framework.MHTML(oApp) ' If we cannot get the MHtml loMHTML.cUrl = lcUrl loMHTML.cDirectory = lcDirectory loMHTML.cFile = lcFile loMHTML.cLicenseKey = lcLicenseKey If Not loMHTML.GetMHTML() Then MessageBox.Show(loMHTML.cMessage, oApp.cTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop) Exit Sub End If