代碼: FunctionGetSerialNumber(sRootAsString)AsLong DimlSerialNumAsLong DimRAsLong DimsTemp1AsString,sTemp2AsString strLabel=String$(255,Chr$(0)) 注釋:磁盤卷標 strType=String$(255,Chr$(0)) 注釋:文件系統類型一般為FAT R=GetVolumeInformation(sRoot,strLabel,Len(strLabel),lSerialNum,0,0,strType,Len(strType)) GetSerialNumber=lSerialNum 注釋:在strLabel中為磁盤卷標 注釋:在strType中為文件系統類型 EndFunction 用法: 當驅動器不存在時,函數返回0。如果是個非根目錄,也將返回0: lSerial=GetSerialNumber("c:\")-> |