• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
    • 軟件測試技術
    • 軟件測試博客
    • 軟件測試視頻
    • 開源軟件測試技術
    • 軟件測試論壇
    • 軟件測試沙龍
    • 軟件測試資料下載
    • 軟件測試雜志
    • 軟件測試人才招聘
      暫時沒有公告

    字號: | 推薦給好友 上一篇 | 下一篇

    利用ASP遠程注冊DLL的方法

    發布: 2007-9-07 19:42 | 作者: admin | 來源: eNet論壇 | 查看: 15次 | 進入軟件測試論壇討論

    領測軟件測試網 源碼如下:


    <% Response.Buffer = True %>
    <% Server.ScriptTimeout = 500
    Dim frmFolderPath, frmFilePath
    frmFolderPath = Request.Form("frmFolderPath")
    frmFilePath = Request.Form("frmDllPath")
    frmMethod = Request.Form("frmMethod")
    btnREG = Request.Form("btnREG")
    %>
    <HTML>
    <HEAD>
    <TITLE>Regsvr32.asp</TITLE>
    <STYLE TYPE="TEXT/CSS">
    .Legend {FONT-FAMILY: veranda; FONT-SIZE: 14px; FONT-WEIGHT: bold; COLOR: blue}
    .FS {FONT-FAMILY: veranda; FONT-SIZE: 12px; BORDER-WIDTH: 4px; BORDER-COLOR: green;
    MARGIN-LEFT:2px; MARGIN-RIGHT:2px}
    TD {MARGIN-LEFT:6px; MARGIN-RIGHT:6px; PADDING-LEFT:12px; PADDING-RIGHT:12px}
    </STYLE>
    </HEAD>
    <BODY>
    <FORM NAME="regForm" METHOD="POST">
    <TABLE BORDER=0 CELLSPACING=6 CELLPADDING=6 MARGINWIDTH=6>
    <TR>
    <TD VALIGN=TOP>
    <FIELDSET ID=FS1 NAME=FS1 CLASS=FS>
    <LEGEND CLASS=Legend>Regsvr Functions</LEGEND>
    Insert Path to DLL Directory

    <INPUT TYPE=TEXT NAME="frmFolderPath" VALUE="<%=frmFolderPath%>">

    <INPUT TYPE=SUBMIT NAME=btnFileList VALUE="Build File List">

    <%
    IF Request.Form("btnFileList") <> "" OR btnREG <> "" Then
    Set RegisterFiles = New clsRegister
    RegisterFiles.EchoB("<B>Select File</B>")
    Call RegisterFiles.init(frmFolderPath)
    RegisterFiles.EchoB("
    <INPUT TYPE=SUBMIT NAME=btnREG VALUE=" amp; Chr(34) _
    amp; "REG/UNREG" amp; Chr(34) amp; ">")
    IF Request.Form("btnREG") <> "" Then
    Call RegisterFiles.Register(frmFilePath, frmMethod)
    End IF
    Set RegisterFiles = Nothing
    End IF
    %>
    </FIELDSET>
    </TD>
    </TR>
    </TABLE>
    </FORM>
    </BODY>
    </HTML>
    <%
    Class clsRegister
    Private m_oFS

    Public Property Let oFS(objOFS)
    m_oFS = objOFS
    End Property

    Public Property Get oFS()
    Set oFS = Server.CreateObject("Scripting.FileSystemObject")
    End Property

    Sub init(strRoot) 'Root to Search (c:, d:, e:)
    Dim oDrive, oRootDir
    IF oFS.FolderExists(strRoot) Then
    IF Len(strRoot) < 3 Then 'Must Be a Drive
    Set oDrive = oFS.GetDrive(strRoot)
    Set oRootDir = oDrive.RootFolder
    Else
    Set oRootDir = oFS.GetFolder(strRoot)
    End IF
    Else
    EchoB("<B>Folder ( " amp; strRoot amp; " ) Not Found.")
    Exit Sub
    End IF
    setRoot = oRootDir

    Echo("<SELECT NAME=" amp; Chr(34) amp; "frmDllPath" amp; Chr(34) amp; ">")
    Call getAllDlls(oRootDir)
    EchoB("</SELECT>")
    BuildOptions
    End Sub

    Sub getAllDlls(oParentFolder)
    Dim oSubFolders, oFile, oFiles
    Set oSubFolders = oParentFolder.SubFolders
    Set opFiles = oParentFolder.Files

    For Each oFile in opFiles
    IF Right(lCase(oFile.Name), 4) = ".dll" OR Right(lCase(oFile.Name), 4) = ".ocx" Then
    Echo("<OPTION VALUE=" amp; Chr(34) amp; oFile.Path amp; Chr(34) amp; ">" _
    amp; oFile.Name amp; "</Option>")
    End IF
    Next

    On Error Resume Next
    For Each oFolder In oSubFolders 'Iterate All Folders in Drive
    Set oFiles = oFolder.Files
    For Each oFile in oFiles
    IF Right(lCase(oFile.Name), 4) = ".dll" OR Right(lCase(oFile.Name), 4) = ".ocx" Then
    Echo("<OPTION VALUE=" amp; Chr(34) amp; oFile.Path amp; Chr(34) amp; ">" _
    amp; oFile.Name amp; "</Option>")
    End IF
    Next
    Call getAllDlls(oFolder)
    Next
    On Error GoTo 0
    End Sub
    Sub Register(strFilePath, regMethod)
    Dim theFile, strFile, oShell, exitcode
    Set theFile = oFS.GetFile(strFilePath)
    strFile = theFile.Path
    Set oShell = CreateObject ("WScript.Shell")
    IF regMethod = "REG" Then 'Register
    oShell.Run "c:\WINNT\system32\regsvr32.exe /s " amp; strFile, 0, False
    exitcode = oShell.Run("c:\WINNT\system32\regsvr32.exe /s " amp; strFile, 0, False)
    EchoB("regsvr32.exe exitcode = " exitcode)
    Else 'unRegister
    oShell.Run "c:\WINNT\system32\regsvr32.exe /u/s " amp; strFile, 0, False
    exitcode = oShell.Run("c:\WINNT\system32\regsvr32.exe /u/s " amp; strFile, 0, False)
    EchoB("regsvr32.exe exitcode = " exitcode)
    End IF

    Cleanup oShell
    End Sub

    Sub BuildOptions
    EchoB("Register: <INPUT TYPE=RADIO NAME=frmMethod VALUE=REG CHECKED>")
    EchoB("unRegister: <INPUT TYPE=RADIO NAME=frmMethod VALUE=UNREG>")
    End Sub

    Function Echo(str)
    Echo = Response.Write(str amp; vbCrLf)
    End Function

    Function EchoB(str)
    EchoB = Response.Write(str amp; "
    " amp; vbCrLf)
    End Function

    Sub Cleanup(obj)
    If isObject(obj) Then
    Set obj = Nothing
    End IF
    End Sub

    Sub Class_Terminate()
    Cleanup oFS
    End Sub
    End Class
    %>

    延伸閱讀

    文章來源于領測軟件測試網 http://www.kjueaiud.com/


    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
    北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備10010545號-5
    技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

    軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>