⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module~1.bas

📁 大型商业学分统计系统原代码说明 1.如果在向导设置班级数为8时,此数值为班级总数
💻 BAS
字号:
Attribute VB_Name = "ModuleExistFile"
Option Explicit
'专门判断文件的存在的函数,比Dir$可靠多了。
'用法:例如判断"c;\temp\test.exe"的存在:
' if exists("c;:\temp\test.exe") then ...
' else msgbox "File not found"
'
Const OFS_MAXPATHNAME = 128
Const OF_EXIST = &H4000
Private Type OFSTRUCT
    cBytes As Byte
    fFixedDisk As Byte
    nErrCode As Integer
    Reserved1 As Integer
    Reserved2 As Integer
    szPathName(OFS_MAXPATHNAME) As Byte
End Type
Private typOfStruct As OFSTRUCT
Declare Function apiOpenFile Lib "kernel32" Alias "OpenFile" (ByVal lpFileName As String, lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long
Public Function Exists(ByVal sFilename As String) As Boolean
    On Error Resume Next
    If Len(sFilename) > 0 Then
        apiOpenFile sFilename, typOfStruct, OF_EXIST
        Exists = typOfStruct.nErrCode <> 2
    End If
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -