您好,欢迎访问一九零五行业门户网

取得磁碟机之Volumn及Serial Number

适用access97、2000 这两项 磁碟 机资料须使用api函数方可 取得 ,代码如下: private declare function getvolumeinformation lib kernel32 alias getvolumeinformationa (byval lprootpathname as string, byval lpvolumenamebuffer as string, byval
适用access97、2000
 这两项磁碟机资料须使用api函数方可取得,代码如下:
private declare function getvolumeinformation lib kernel32 alias getvolumeinformationa (byval lprootpathname as string, byval lpvolumenamebuffer as string, byval nvolumenamesize as long, lpvolumeserialnumber as long, lpmaximumcomponentlength as long, lpfilesystemflags as long, byval lpfilesystemnamebuffer as string, byval nfilesystemnamesize as long) as long
function getvolumn(x as string) as string
    if len(x)         x = left(x, 1) & :\
    else
        x = left(x, 3)
    end if
    dim nret as long, volname as string, volsn as long, maxcomplen as long
    dim volflags as long, volfilesys as string
    volname = space$(256)
    volfilesys = space$(256)
    nret = getvolumeinformation(x, volname, len(volname), _
            volsn, maxcomplen, volflags, _
            volfilesys, len(volfilesys))
    if nret = 1 then
        getvolumn = volname
    else
        getvolumn =
    end if
end function
function getnumber(x as string) as string
    if len(x)         x = left(x, 1) & :\
    else
        x = left(x, 3)
    end if
    dim nret as long, volname as string, volsn as long, maxcomplen as long
    dim volflags as long, volfilesys as string
    volname = space$(256)
    volfilesys = space$(256)
    nret = getvolumeinformation(x, volname, len(volname), _
            volsn, maxcomplen, volflags, _
            volfilesys, len(volfilesys))
    if nret = 1 then
        getnumber = volsn
    else
        getvolumn =
    end if
end function
前面的declare陈述式宣告一个api函数(getvolumeinformation),可取得磁碟机的两项资料。
本文作者:
其它类似信息

推荐信息