jesh Newbie
Joined: 23 May 2009 Posts: 3
|
Posted: Tue Mar 23, 2010 1:59 pm
Help :Zmud COM Project question! |
I have created a Com object step by step as 'zMUD COM Plugins' Document use VB6 and it has a function named 'fReplace'.
Generate Dll Object named 'DecodeServer.dll ' and Use this CMDS 'regsvr32 "D:\Program Files\zMUD\DecodeServer.dll"' register it successfully.
I want it executing jobs according to the following step:
1. I log ZMUD screen content to a file named 'Decode.txt'
2. Install ''DecodeServer.dll ' in Zmud Plugin interface, create a COM Object Link as the follow CMDS IN zMUD:
#va DecodeServer %comcreate("Zmud.Application");
#va Zmudses @DecodeServer.CurrentSession
3. Use function 'fReplace' for a specific task , be in 'Decode.txt' file with all occurrences of Char1 replaced with Char2.
#va fReplace @Zmudses.fReplace;
Zmud show this error message: no method/property name: fReplace.
I have't known where the mistake depends on! Help me please!
'DecodeServer.DLL Source code as follows:
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 = "[* Edit: Taz]Removed developer kit registration code[End Edit]"
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
Public Function 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 Function |
|