大漠注册 时调用大漠插件的第一步,下面介绍两种注册方法
//方法1 // 判断大漠插件是否注册到系统 Function IsRegDM(sVer) Dim TmpObj Set TmpObj = CreateObject("dm.dmsoft") If VarType(TmpObj) = 9 Then If TmpObj.Ver = sVer Then IsRegDM = True End If End If Set TmpObj = Nothing End Function // 注册大漠插件到系统 Function RegDM(sPath, sVer) If IsRegDM(sVer) = False Then Call Plugin.RegDll.Reg(sPath) If IsRegDM(sVer) = False Then Dim TmpWSH Set TmpWSH = CreateObject("WScript.Shell") Call TmpWSH.Run("regsvr32 /s " & sPath, 0, True) Set TmpWSH = Nothing RegDM = IsRegDM(sVer) Else RegDM = True End If Else RegDM = True End If End Function TracePrint RegDM("c:\dm.dll", "3.1233") TracePrint IsRegDM("3.1233")
//方法2 Function 注册大漠() Dim i //释放附件内容 PutAttachment "C:\test_game", "*.*" Set ws = createobject("Wscript.Shell") For i = 0 To 20 //注册atl跟dm插件 ws.run("regsvr32 atl.dll -s") ws.run ("regsvr32 C:\test_game\dm.dll -s") Delay 200 Set ws = nothing Set dm = createobject("dm.dmsoft") ver = dm.ver() //输出版本号 If ver <> "" Then //TracePrint "注册成功" Exit For End If Next If i >= 20 Then TracePrint "大漠插件注册失败!" EndScript End If Set dm = nothing Delay 10 End Function