//---------------------
代碼: 選擇全部
#INCLUDE "FIVEWIN.CH"
#INCLUDE "STRUCT.CH"
Func Test()
Local nRet := 0,;
aRet := {},;
nI := 0,;
cStr := [],;
oVer := NIL
msgInfo( "Begin!!" )
//-------------------------------------------------------
// SmartFindATADisk(nDisk) -> direct ATA Disk
//-------------------------------------------------------
cStr := []
for nI := 0 To 25
nRet = SmartFindATADisk( nI ) // Is ATA DISK ?
cStr += LTrim( Str(nI))+":"+If( nRet > 0, "Yes", "No" )+" ATA DISK"+CRLF
next nI
msgInfo( cStr )
nRet := SmartFindATADisk( 255 ) // Get Total ATA Disk
msgInfo( "Total ATA DISK:["+LTrim( Str( nRet ))+"]", "All")
//-------------------------------------------------------
// SmartIdentify(nDisk) -> Get HDD model/Serial/Firmware
//-------------------------------------------------------
aData := SmartIdentify(0) // 0: Driver 'C'
If Len(aData) < 1
MsgStop( "get HDD low level data fail" )
Else
msgInfo( RTrim(aData[1]), "model" +str(len(aData[1])) )
msgInfo( RTrim(aData[2]), "Serial:" +str(len(aData[2])) )
msgInfo( RTrim(aData[3]), "Firmware:"+str(len(aData[3])) )
EndIf
//-------------------------------------------------------
// SmartVersion() -> Get Smart Version
//-------------------------------------------------------
STRUCT oVer // lenght := 5
MEMBER bVersion AS BYTE //
MEMBER bRevision AS BYTE //
MEMBER bIDEDeviceMap AS BYTE //
MEMBER fCapabilities AS BYTE //
MEMBER nError AS BYTE // 1:Error/ 0:Success
ENDSTRUCT
SmartVersion( @oVer:cBuffer )
If oVer:nError <> 0
msgStop( "Get Version fail!" )
return nil
EndIf
cStr := []
cStr += "version ["+Str(oVer:bVersion)+"."+Str(oVer:bRevision)+"]"+CRLF
cStr += "bIDEDeviceMap[0x"+I2Hex(oVer:bIDEDeviceMap)+"]"+CRLF
cStr += "fCapabilities : [0x"+I2Hex(oVer:fCapabilities)+"]"
msgInfo( cStr, "Version" )
RETURN NIL
Samples (This library is compiler with Borland C++ 5.5)
//---------------------
Code:
#INCLUDE "FIVEWIN.CH"
#INCLUDE "STRUCT.CH"
Func Test()
Local nRet := 0,;
aRet := {},;
nI := 0,;
cStr := [],;
oVer := NIL
msgInfo( "Begin!!" )
//-------------------------------------------------------
// SmartFindATADisk(nDisk) -> direct ATA Disk
//-------------------------------------------------------
cStr := []
for nI := 0 To 25
nRet = SmartFindATADisk( nI ) // Is ATA DISK ?
cStr += LTrim( Str(nI))+":"+If( nRet > 0, "Yes", "No" )+" ATA DISK"+CRLF
next nI
msgInfo( cStr )
nRet := SmartFindATADisk( 255 ) // Get Total ATA Disk
msgInfo( "Total ATA DISK:["+LTrim( Str( nRet ))+"]", "All")
//-------------------------------------------------------
// SmartIdentify(nDisk) -> Get HDD model/Serial/Firmware
//-------------------------------------------------------
aData := SmartIdentify(0) // 0: Driver 'C'
If Len(aData) < 1
MsgStop( "get HDD low level data fail" )
Else
msgInfo( RTrim(aData[1]), "model" +str(len(aData[1])) )
msgInfo( RTrim(aData[2]), "Serial:" +str(len(aData[2])) )
msgInfo( RTrim(aData[3]), "Firmware:"+str(len(aData[3])) )
EndIf
//-------------------------------------------------------
// SmartVersion() -> Get Smart Version
//-------------------------------------------------------
STRUCT oVer // lenght := 5
MEMBER bVersion AS BYTE //
MEMBER bRevision AS BYTE //
MEMBER bIDEDeviceMap AS BYTE //
MEMBER fCapabilities AS BYTE //
MEMBER nError AS BYTE // 1:Error/ 0:Success
ENDSTRUCT
SmartVersion( @oVer:cBuffer )
If oVer:nError <> 0
msgStop( "Get Version fail!" )
return nil
EndIf
cStr := []
cStr += "version ["+Str(oVer:bVersion)+"."+Str(oVer:bRevision)+"]"+CRLF
cStr += "bIDEDeviceMap[0x"+I2Hex(oVer:bIDEDeviceMap)+"]"+CRLF
cStr += "fCapabilities : [0x"+I2Hex(oVer:fCapabilities)+"]"
msgInfo( cStr, "Version" )
RETURN NIL