关于我的程序"溢出"的源代码code !!!!!!!!!!!!

WangTiger 2000-05-19 08:43:00
Dim Text
Dim found
Dim Found_2
Dim url
Dim File_no
Dim Writed_no
Option Explicit

Private Sub Command1_Click()
If Option1.Value = True Then
CommonDialog1.ShowOpen
RichTextBox1.LoadFile CommonDialog1.FileName, rtfText
Do
sReplace RichTextBox1.Text, Text1.Text, Text2.Text
Loop Until Text1.ToolTipText = "0"
RichTextBox1.SaveFile CommonDialog1.FileName, rtfText
Text1.ToolTipText = ""
Else
Dim starttime As Single

findfilesdir Text3.Text, Text4.Text

End If
Do Until List1.ListCount = 0
RichTextBox1.Text = ""
RichTextBox1.LoadFile List1.List(0), rtfText
Do
sReplace RichTextBox1.Text, Text1.Text, Text2.Text
Loop Until Text1.ToolTipText = "0"
RichTextBox1.SaveFile List1.List(0), rtfText
List1.RemoveItem 0
Text1.ToolTipText = ""


Loop
End Sub

Private Sub Command2_Click()
RichTextBox1.SelStart = 0

Do Until found = -1
found = RichTextBox1.Find(Text1.Text, RichTextBox1.SelStart, , rtfWholeWord)
If found <> -1 Then
RichTextBox1.Span "", True, True
RichTextBox1.SelText = Text2.Text
Else
MsgBox "没有查到!"
End If
Loop
End Sub


Public Sub findfilesdir(DirPath As String, FileSpec As String)
Dim filestring As String

DirPath = Trim$(DirPath)

If Right$(DirPath, 1) <> "\" Then
DirPath = DirPath & "\"
End If

filestring = Dir$(DirPath & FileSpec, vbArchive Or vbHidden Or vbSystem Or vbDirectory)
Do
DoEvents
If filestring = "" Then
Exit Do
Else
If (GetAttr(DirPath & filestring) And vbDirectory) = vbDirectory Then
If Left$(filestring, 1) <> "." And Left$(filestring, 2) <> ".." Then
End If
Else
url = DirPath & filestring
List1.AddItem url
File_no = File_no + 1
End If
End If

filestring = Dir$
Loop

End Sub

Private Sub Form_Load()
Writed_no = 0
File_no = 0
End Sub

Private Sub Form_Unload(Cancel As Integer)
End
End Sub

Private Sub Option1_Click()
Text3.Enabled = False
End Sub

Private Sub Option2_Click()
Text3.Enabled = True
End Sub


Function sReplace(SearchLine As String, SearchFor As String, ReplaceWith As String)
Dim vSearchLine As String, found As Integer

found = InStr(SearchLine, SearchFor): vSearchLine = SearchLine
If found <> 0 Then

vSearchLine = ""
If found > 1 Then vSearchLine = Left(SearchLine, found - 1)
vSearchLine = vSearchLine + ReplaceWith
If found + Len(SearchFor) - 1 < Len(SearchLine) Then _
vSearchLine = vSearchLine + Right$(SearchLine, Len(SearchLine) - found - Len(SearchFor) + 1)

End If
sReplace = vSearchLine

RichTextBox1.Text = sReplace
Text1.ToolTipText = found
End Function
...全文
64 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

741

社区成员

发帖
与我相关
我的任务
社区描述
VB 版八卦、闲侃,联络感情地盘,禁广告帖、作业帖
社区管理员
  • 非技术类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧