关于Com插件
不懂VB,这两天看资料为一个应用软件mud写了一个插件,想实现从应用软件调用COM插件,将特定的decode.txt文件的指定的字符Char1替换成Char2,IzMUDPlugin是应用提供的一个接口,红色部分是必须默认的东西,具体怎么用不是很清楚。
fReplace是我想实现的功能,编译可以成功,但是调用不了,请高手指点!
Option Explicit
Implements IzMUDPlugin
Private Sub IzMUDPlugin_AddCommands(FileName As String, ComVersion As Long)
End Sub
Private Sub IzMUDPlugin_AddMenu(ByVal MenuIndex As Long, Caption As String, HelpStr As String, ComID As Long, ByVal M As Long)
End Sub
Private Property Get IzMUDPlugin_CanCapture() As Boolean
End Property
Private Sub IzMUDPlugin_CaptureOutput(ByVal H As Long, ByVal AsciiText As String, ByVal RawText As String)
End Sub
Private Sub IzMUDPlugin_Close()
End Sub
Private Sub IzMUDPlugin_CloseThread(ByVal H As Long)
End Sub
Private Function IzMUDPlugin_CustomEdit(ByVal Ref As String, ByVal s As String) As Boolean
End Function
Private Sub IzMUDPlugin_Init()
End Sub
Private Sub IzMUDPlugin_LoadSettings(ByVal P As String, ByVal L As Long)
End Sub
Private Sub IzMUDPlugin_Menu(ByVal H As Long, ByVal ComID As Long)
End Sub
Private Sub IzMUDPlugin_MUDInput(ByVal H As Long, P As String)
End Sub
Private Sub IzMUDPlugin_OnConnect(ByVal H As Long)
End Sub
Private Sub IzMUDPlugin_OnDisconnect(ByVal H As Long)
End Sub
Private Sub IzMUDPlugin_OpenThread(ByVal H As Long, ByVal Name As String, ByVal Host As String, ByVal Port As Long)
End Sub
Private Sub IzMUDPlugin_Parse(ByVal H As Long, P As String, ByVal IsPrompt As Boolean, DoGag As Long, DoUpdate As Boolean)
End Sub
Private Sub IzMUDPlugin_plugCommand(ByVal H As Long, ByVal ComID As Long, ByVal ComStr As String, ByVal P As Variant)
End Sub
Private Function IzMUDPlugin_plugFunction(ByVal H As Long, ByVal ComID As Long, ByVal ComStr As String, ByVal P As Variant) As String
End Function
Private Sub IzMUDPlugin_Register(Name As String, Company As String, Regcode As String, Description As String, Version As String, HelpFile As String, LoadDef As Boolean)
Name = "Decode Plugin"
Company = "Zor Software"
Regcode = "01E8JW-ZVJNXR-9WR4D5-RZGJBD-UXQTTG-ZGD02Y-1M23T3-X82M0D-G02A0V-5MKKGC"
Description = "This is a decode plugin "
HelpFile = ""
LoadDef = True
End Sub
Private Property Get IzMUDPlugin_SaveSettings() As String
End Property
Private Sub IzMUDPlugin_Status(ByVal Stat As Long)
End Sub
Private Sub IzMUDPlugin_Update(ByVal H As Long)
End Sub
Private Sub IzMUDPlugin_UserInput(ByVal H As Long, P As String, SendToMUD As Boolean)
End Sub
Private Property Get IzMUDPlugin_Version() As Long
IzMUDPlugin_Version = "721"
End Property
Private Sub fReplace(Char1 As String, Char2 As String)
Dim ZmudApp As Object
Dim Zmudses As Object
Set ZmudApp = CreateObject("Zmud.Application")
Set Zmudses = ZmudApp.CurrentSession
Dim TxtLine As String
Dim TxtChar As String
Open "D:\Program Files\zMUD\Decode.txt" For Input As #1 '读出
Do While Not EOF(1)
Line Input #1, TxtLine
TxtChar = TxtChar & TxtLine & vbCrLf
Loop
Close #1
TxtChar = Replace(TxtChar, "Char1", Char2)
Open "D:\Program Files\zMUD\Decode.txt" For Output As #1 '写入
Print #1, TxtChar
Close #1
End Sub
[解决办法]