VBScript-----------------------------------------------ROOT1---------------------------------------
*******************************************************************************************
* Use this class to manage and register your DLL in an ASP page
* This class is tested on win 2 K through
* Note: Use this class to create an XML file first. The documents are as follows. Open Notepad to save the following 3 lines as *. XML file
*
* <?xml version= "1.0" encoding= "gb2312" standalone= "yes"?>
* <dll list >
* </dll list >
*
*------------------------------------------------------------------------------------------
Example
* Dim ObjRegsvr32
* Set ObjRegsvr32 = new Regsvr32
* with ObjRegsvr32
* If. Loadxml (".. /mydll.xml ") Then
* Call Response.Write ("XML file load Error")
* Set ObjRegsvr32 = Nothing
* Response.End
* End If
* Select Case. AddNode ("F:\web\cw31072\dll\test\MyClass.dll", True) ' Add new entry and register DLL
* Case 1
* Call Response.Write ("entry has been added to XML file!") and successfully registered DLL! ")
* Case 0
* Call Response.Write ("entry has been added to XML file!") But failed to register DLL! ")
* Case-1
* Call Response.Write ("The entry is already in the XML file!") The DLL has also been registered! ")
* End Select
* ..........................
* End With
*
* ' This class is very simple, there are some methods, I do not give an example, see To know. You can open it later.
* ' The XML file looks at the list of DLLs that you have registered and that you want to register.
* ' XML file for each entry as follows: <dll has been registered = "1" >F:\web\cw31072\dll\test\MyClass.dll</Dll>
* ' F:\web\cw31072\dll\test\MyClass.dll is your path to the DLL file
* "has been registered =" 1 "is that the DLL has been registered, =" 0 "is not registered yet!
*******************************************************************************************
Class Regsvr32
Private S_objxml
Private S_objnoderoot
Private S_strxmlpath
Private S_strattributename
'------------------------------------
' Purpose: Load DLL configuration XML file
' Parameter: XML file address
' Return: Return true on load failure
'------------------------------------
Public Function Loadxml (strpath)
Set S_objxml = CreateObject ("MSXML2. DOMDocument ")
S_objxml.async = False
S_objxml.load (strpath)
If S_objXml.parseError.errorCode <> 0 Then
Set s_objxml = Nothing
Loadxml = True
Exit function
End If
Set s_objnoderoot = S_objxml.documentelement
S_strxmlpath = strpath
S_strattributename = "is registered"
End Function
'---------------------------------------------
' Purpose: To add a DLL project
' Parameter: Strpath:dll file address
' Blnreg: Whether to register it after adding
' Return: If required to add after registration, registration success will return 1, registration failure to return 0, already have the item and note the book return-1
'---------------------------------------------
Public Function Addn