📄 vb_dos.frm
字号:
VERSION 5.00
Begin VB.Form frmvbdos
AutoRedraw = -1 'True
BackColor = &H00000000&
Caption = "VB Dos 模式"
ClientHeight = 8595
ClientLeft = 60
ClientTop = 345
ClientWidth = 11880
ForeColor = &H00FFFFFF&
Icon = "vb_dos.frx":0000
LinkTopic = "Form1"
ScaleHeight = 35.813
ScaleMode = 4 'Character
ScaleWidth = 99
StartUpPosition = 2 '屏幕中心
Begin VB.DriveListBox Drive1
BeginProperty Font
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
Left = 1320
TabIndex = 1
Top = 120
Visible = 0 'False
Width = 975
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 250
Left = 120
Top = 720
End
Begin VB.Image Image1
Height = 975
Left = 120
Top = 1200
Width = 2175
End
Begin VB.Label Label1
BackColor = &H00000000&
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 480
Left = 120
TabIndex = 0
Top = 120
Visible = 0 'False
Width = 855
End
End
Attribute VB_Name = "frmvbdos"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'CODE Manger By BcodeXRose
'使用 Option Explicit 可以避免隐式创建 Variant 类型的变量
Option Explicit
Dim ExeName As String '系统EXE文件名
Dim CmdStr As String '命令处理
Dim ParStr As String '参数处理
'文件处理
Dim FileL As Long '文件长度
Dim FileN As String '文件名称(源)
Dim FileNew As String '文件名称(新)
Dim FileAttr As Integer '文件属性(0~8)
Dim DirN As String '目录处理
Dim i As Long '循环处理计数
Dim j As Long
Dim m As Long '普通长整型数值
Dim n As Long
Dim p As Long
Dim tmpStr As String '临时字串
Dim NU2EN As CNU2EN '定义类模块
'+----+----+----+----+----+----+----+----+----+----+----+----+----+
'+----+----+--- 过程名称:Form_KeyPress
'+----+----+--- 参数:keyascii 为Integer型
'+----+----+----+----+----+----+----+----+----+----+----+----+----+
Private Sub Form_KeyPress(keyascii As Integer)
On Error GoTo ErrHandel
If keyascii > 31 And keyascii < 127 Then
Print Chr(keyascii); '若不为控制符在屏幕上输出输入的字符
End If
Label1.Move CurrentX, CurrentY '显示光标
If CurrentX > Int(Me.ScaleWidth) - 1 Then '大于SCALE的显示宽度就换行
CurrentX = 0
CurrentY = CurrentY + 1
End If
If CurrentY > Int(Me.ScaleHeight) - 1 Then '大于SCALE的显示高度40换页
Cls
Image1.Picture = LoadPicture("")
GoTo DosPrompt '显示提示符
End If
If keyascii = 27 Then '如果是取消,则换行
CurrentX = 0
CurrentY = CurrentY + 1
GoTo DosPrompt '显示提示符
End If
If keyascii = 13 Then '//*如果是回车(13)则开始执行*//
CurrentX = 0
CurrentY = CurrentY + 1 '换行,准备执行命令
CmdStr = UCase$(Trim$(CmdStr)) '将命令转为大写并消去前面的空格
Select Case CmdStr
' /========================/
' /*以下为无参数命令的处理*/
'/========================/
Case "CLS" '//* CLS * //
Cls '清除字符显示
Image1.Picture = LoadPicture("") '清除图片显示
Case "CD\" '//* CD\ * // =>解释为CD \ 返回根目录
ChDir "\"
Case "CD." '//* CD. * // =>解释为CD . 返回当前目录
ChDir CurDir$
Case "CD.." '//* CD.. * // =>解释为CD .. 返回上一级目录
ChDir ".."
Case "CD..." '//* CD...* // =>解释为CD ...返加上两级目录
ChDir "..."
Case "DATE" '//* DATE * //
Print "今天是:" & Date
Case "DAY" '//* DAY * //
Print "今天是:" & Day(Now) & "号"
Case "DIR" '//* DIR * //
Call FileList
Case "EXIT" '//* EXIT * //
Call ExitPrg
Case "?" '//*?(问号)* //
Call DisplayHelp
Case "HELP" '//* HELP * //
Call DisplayHelp
Case "LISTDRIVE" '//* LISTDRV*//
Call GetDriveList
Case "MAX" '//* MAX *//
Me.Top = 1
Me.Left = 1
Me.Width = Screen.Width
Me.Height = Screen.Height
Case "MONTH" '//* MONTH * //
Print "本月月份是:" & Month(Now) & "月"
Case "PATH" '//* PATH * //
Print "当前路径是:" & App.Path
Case "TIME" '//* TIME * //
Print "现在时间:" & Time
Case "TIMER" '//* TIMER * //
Print "当前秒数:" & Timer
Case "VER" '//* VER * //
Call GetOSVersion
Case "WEEK" '//* WEEK * //
Call GetWeekName
Case "YEAR" '//* YEAR * //
Print "今年是" & Year(Now) & "年"
Case "99TAB" '//* 99TAB *//
Call Disp99TAB
'/=================================/
'/*以下为有参数命令的使用说明处理*/
'/===============================/
Case "CD"
Print "使用方法:CD directoryName$"
Print " directoryName$ -> 要进入的目录名"
Case "CALL"
Print "使用方法:Call fileName$"
Print " fileName$ -> 要运行的程式名称"
Case "CACL"
Print "使用方法:Cacl expression$"
Print " expression$ -> 要进行计算的表达式"
Case "CACLTRIANGLE"
Print "使用方法:CaclTriangle a,b,c"
Print " a,b,c -> 输入三角形的三个边,中间以逗号隔开"
Case "CACLDIVISOR"
Print "使用方法:CaclDivisor a,b"
Print " a,b -> 输入两个整数并以逗号隔开,返回这两个数的最大公约数"
Case "CACLNATURAL"
Print "使用方法:CaclNatural number"
Print " number -> 要分解的自然数"
Case "COPY"
Print "使用方法:Copy fileName$"
Print " fileName$ -> 要复制到当前目录的文件名"
Case "COLOR"
Print "使用方法:Color qbColorNumber"
Print " qbColorNumber -> QB的色彩代码(0-15)"
Case "CHDRIVE"
Print "使用方法:ChDrive driveName$"
Print " driveName$ -> 要进入的驱动器盘符(A-Z)"
Case "CHDIR"
Print "使用方法:ChDir directoryName$"
Print " directoryName$ -> 要进入的目录名"
Case "DEC2HEX"
Print "使用方法:Dec2Hex decFormatNumber"
Print " decFormatNumber -> 要转换的十进制数"
Case "DEL"
Print "使用方法:Del fileName$"
Print " fileName$ -> 要删除的文件名"
Case "FILELEN"
Print "使用方法:FileLen fileName$"
Print " fileName$ -> 要测试的文件名"
Case "FILEDATETIME"
Print "使用方法:FileDateTime fileName$"
Print " fileName$ -> 要测试的文件名"
Case "GETATTR"
Print "使用方法:GetAttr fileName$"
Print " fileName$ -> 要测试的文件名"
Case "GETASCII"
Print "使用方法:GetASCII string$"
Print " string$ -> 要测试其十进制ASCII码的字符"
Case "GETCHR"
Print "使用方法:GetChr ASCIIcode"
Print " ASCIIcode -> 要转换为字符的十进制ASCII码"
Case "ISPRIME"
Print "使用方法:IsPrime number"
Print " number -> 要判定是否为质数的数字"
Print "说 明:质数就是一个数的因子只有一与它本身的数."
Case "KILL"
Print "使用方法:Kill fileName$"
Print " fileName$ -> 要删除的文件名"
Case "LOADBMP"
Print "使用方法:LoadBMP fileName$"
Print " fileName$ -> 要显示的BMP图片文件名"
Case "LISTPRIME"
Print "使用方法:ListPrime number"
Print " number -> 要列出质数列表的范围"
Print "说 明:质数就是一个数的因子只有一与它本身的数."
Case "LISTPERFECT"
Print "使用方法:ListPerfect number"
Print " number -> 要列出完数列表的范围"
Print "说 明:完数就是一个数等于它的各因子之和等于它本身的数."
Case "LISTFLOWER"
Print "使用方法:ListFlower number"
Print " number -> 要列出水仙花数列表的范围"
Print "说 明:水仙花数就是一个数每位数立方的和等于它本身的数."
Case "MD"
Print "使用方法:MD directoryName$"
Print " directoryName$ -> 要创建的目录名"
Case "MKDIR"
Print "使用方法:MkDir directoryName$"
Print " directoryName$ -> 要创建的目录名"
Case "MOVE"
Print "使用方法:Move fileName$"
Print " fileName$ -> 要移动到当前目录的文件名"
Case "NU2EN"
Print "使用方法:NU2EN number"
Print " number -> 要转成英文的阿拉伯数字"
Case "RD"
Print "使用方法:RD directoryName$"
Print " directoryName$ -> 要删除的目录名"
Case "RMDIR"
Print "使用方法:RmDir directoryName$"
Print " directoryName$ -> 要删除的目录名"
Case "SETATTRREADONLY"
Print "使用方法:SetAttrReadOnly fileName$"
Print " fileName$ -> 要设定为只读属性的文件名"
Case "SETATTRHIDDEN"
Print "使用方法:SetAttrHidden fileName$"
Print " fileName$ -> 要设定为隐藏属性的文件名"
Case "SETATTRSYSTEM"
Print "使用方法:SetAttrSystem fileName$"
Print " fileName$ -> 要设定为系统属性的文件名"
Case "TYPE"
Print "使用方法:Type fileName$"
Print " fileName$ -> 要显示内容的文件名"
'/=======================/
'/*以下是有参数命令的处理*/
'/======================/
Case Else
If Left$(CmdStr, 5) = "CALL " Then '//* CALL * // -- 调用一个外部程式或命令 --
FileN = Right$(CmdStr, Len(CmdStr) - 5)
If Dir$(FileN) = "" Then
Print "文件未找到."
GoTo DosPrompt
End If
Shell FileN, vbNormalFocus '调用程式
ElseIf Left$(CmdStr, 5) = "CACL " Then '//* CACL * // -- 表达式计算器 --
Dim strexp As String, Temp As String
Dim a As Double, b As Boolean
strexp = Right$(CmdStr, Len(CmdStr) - 5)
For i = 1 To Len(strexp)
Temp = Mid$(strexp, i, 1)
If Asc(Temp) <= Asc("z") And Asc(Temp) >= Asc("a") Then
strexp = Left$(strexp, i - 1) + StrConv(Temp, vbUpperCase) + Right$(strexp, Len(strexp) - i)
End If
Next i
a = CalculateString(strexp, b, 1)
If b = True Then
Print "计算结果为:" & Str$(a) '显示结果
Else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -