亚洲乱色熟女一区二区三区丝袜,天堂√中文最新版在线,亚洲精品乱码久久久久久蜜桃图片,香蕉久久久久久av成人,欧美丰满熟妇bbb久久久

LOGO OA教程 ERP教程 模切知識(shí)交流 PMS教程 CRM教程 開發(fā)文檔 其他文檔  
 
網(wǎng)站管理員

真正獲取硬盤序號(hào)和型號(hào)及固件版本

admin
2013年11月14日 22:12 本文熱度 6584

 

建窗體,窗體放置1個(gè)ComBox,命名為cbDrive,1個(gè)ListBox,命名為lstMain,一個(gè)CommandButton,命名為cmdGo,添加如下代碼:

Dim h As clsMainInfo

Private Sub cmdGo_Click()

    Dim hT As Long
    Dim uW() As Byte
    Dim dW() As Byte
    Dim pW() As Byte
    
    Set h = New clsMainInfo
    
    With h
        .CurrentDrive = Val(cbDrive.Text)
         lstMain.Clear
         lstMain.AddItem "當(dāng)前驅(qū)動(dòng)器: " & .CurrentDrive
         lstMain.AddItem ""
         lstMain.AddItem "硬盤型號(hào): " & .GetModelNumber
         lstMain.AddItem "序列號(hào): " & .GetSerialNumber
         lstMain.AddItem "固件版本: " & .GetFirmwareRevision
    End With
    
    Set h = Nothing
    
End Sub

Private Sub Form_Load()
    cbDrive.AddItem 0
    cbDrive.AddItem 1
    cbDrive.AddItem 2
    cbDrive.AddItem 3
    cbDrive.ListIndex = 0
End Sub


'-------------------添加類模塊-------------------------

Option Explicit

Private Const VER_PLATFORM_WIN32S [color=#0000ff]=
0
Private Const VER_PLATFORM_WIN32_WINDOWS = 1
Private Const VER_PLATFORM_WIN32_NT = 2

Private Const DFP_RECEIVE_DRIVE_DATA = &H7C088

Private Const FILE_SHARE_READ = &H1
Private Const FILE_SHARE_WRITE = &H2
Private Const GENERIC_READ = &H80000000
Private Const GENERIC_WRITE = &H40000000
Private Const OPEN_EXISTING = 3
Private Const Create_NEW = 1

Private Enum HDINFO
    HD_MODEL_NUMBER
    HD_SERIAL_NUMBER
    HD_FIRMWARE_REVISION
End Enum

Private Type OSVERSIONINFO
    dwOSVersionInfoSize As Long
    dwMajorVersion As Long
    dwMinorVersion As Long
    dwBuildNumber As Long
    dwPlatformId As Long
    szCSDVersion As String * 128
End Type

Private Type IDEREGS
    bFeaturesReg As Byte
    bSectorCountReg As Byte
    bSectorNumberReg As Byte
    bCylLowReg As Byte
    bCylHighReg As Byte
    bDriveHeadReg As Byte
    bCommandReg As Byte
    bReserved As Byte
End Type

Private Type SENDCMDINPARAMS
    cBufferSize As Long
    irDriveRegs As IDEREGS
    bDriveNumber As Byte
    bReserved(1 To 3) As Byte
    dwReserved(1 To 4) As Long
End Type

Private Type DRIVERSTATUS
    bDriveError As Byte
    bIDEStatus As Byte
    bReserved(1 To 2) As Byte
    dwReserved(1 To 2) As Long
End Type

Private Type SENDCMDOUTPARAMS
    cBufferSize As Long
    DStatus As DRIVERSTATUS
    bBuffer(1 To 512) As Byte
End Type

Private Declare Function GetVersionEx _
    Lib "kernel32" Alias "GetVersionExA" _
    (lpVersionInformation As OSVERSIONINFO) As Long

Private Declare Function CreateFile _
    Lib "kernel32" Alias "CreateFileA" _
    (ByVal lpFileName As String, _
    ByVal dwDesiredAccess As Long, _
    ByVal dwShareMode As Long, _
    ByVal lpSecurityAttributes As Long, _
    ByVal dwCreationDisposition As Long, _
    ByVal dwFlagsAndAttributes As Long, _
    ByVal hTemplateFile As Long) As Long

Private Declare Function CloseHandle _
    Lib "kernel32" _
    (ByVal hObject As Long) As Long

Private Declare Function DeviceIoControl _
    Lib "kernel32" _
    (ByVal hDevice As Long, _
    ByVal dwIoControlCode As Long, _
    lpInBuffer As Any, _
    ByVal nInBufferSize As Long, _
    lpOutBuffer As Any, _
    ByVal nOutBufferSize As Long, _
    lpBytesReturned As Long, _
    ByVal lpOverlapped As Long) As Long
    
Private Declare Sub ZeroMemory _
    Lib "kernel32" Alias "RtlZeroMemory" _
    (dest As Any, _
    ByVal numBytes As Long)

Private Declare Sub CopyMemory _
    Lib "kernel32" Alias "RtlMoveMemory" _
    (Destination As Any, _
    Source As Any, _
    ByVal Length As Long)

Private Declare Function GetLastError _
    Lib "kernel32" () As Long

Private mvarCurrentDrive As Byte
Private mvarPlatform As String

Public Function GetModelNumber() As String
    
    GetModelNumber = CmnGetHDData(HD_MODEL_NUMBER)
    
End Function

Public Function GetSerialNumber() As String
    
    GetSerialNumber = CmnGetHDData(HD_SERIAL_NUMBER)
    
End Function

Public Function GetFirmwareRevision() As String
    
    GetFirmwareRevision = CmnGetHDData(HD_FIRMWARE_REVISION)
    
End Function

Public Property Let CurrentDrive(ByVal vData As Byte)
    
    If vData < 0 or vData > 3 Then
        Err.Raise 10000, , "Illegal Drive Number"
    End If
    
    mvarCurrentDrive = vData

End Property

Public Property Get CurrentDrive() As Byte
    
    CurrentDrive = mvarCurrentDrive

End Property

Public Property Get Platform() As String
    
    Platform = mvarPlatform

End Property

Private Sub Class_Initialize()

    Dim OS As OSVERSIONINFO
        
    OS.dwOSVersionInfoSize = Len(OS)
    Call GetVersionEx(OS)
    mvarPlatform = "Unk"
    Select Case OS.dwPlatformId
        Case Is = VER_PLATFORM_WIN32S
            mvarPlatform = "32S"
        Case Is = VER_PLATFORM_WIN32_WINDOWS
            If OS.dwMinorVersion = 0 Then
                mvarPlatform = "W95"
            Else
                mvarPlatform = "W98"
            End If
        Case Is = VER_PLATFORM_WIN32_NT
            mvarPlatform = "WNT"
    End Select

End Sub

Private Function CmnGetHDData(hdi As HDINFO) As String

    Dim bin As SENDCMDINPARAMS
    Dim bout As SENDCMDOUTPARAMS
    Dim hdh As Long
    Dim br As Long
    Dim ix As Long
    Dim hddfr As Long
    Dim hddln As Long
    Dim s As String
    
    Select Case hdi
        Case HD_MODEL_NUMBER
            hddfr = 55
            hddln = 40
        Case HD_SERIAL_NUMBER
            hddfr = 21
            hddln = 20
        Case HD_FIRMWARE_REVISION
            hddfr = 47
            hddln = 8
        Case Else
            Err.Raise 10001, "Illegal HD Data type"
    End Select
    
    Select Case mvarPlatform
        Case "WNT"
            hdh = CreateFile("\\.\PhysicalDrive" & mvarCurrentDrive, _
                GENERIC_READ + GENERIC_WRITE, FILE_SHARE_READ + FILE_SHARE_WRITE, _
                0, OPEN_EXISTING, 0, 0)
        Case "W95", "W98"
            hdh = CreateFile("\\.\Smartvsd", _
                0, 0, 0, Create_NEW, 0, 0)
        Case Else
            Err.Raise 10002, , "Illegal platform (only WNT, W98 or W95)"
    End Select
    
    If hdh = 0 Then
        Err.Raise 10003, , "Error on CreateFile"
    End If
    
    ZeroMemory bin, Len(bin)
    ZeroMemory bout, Len(bout)
    
    With bin
        .bDriveNumber = mvarCurrentDrive
        .cBufferSize = 512
        With .irDriveRegs
            If (mvarCurrentDrive And 1) Then
                .bDriveHeadReg = &HB0
            Else
                .bDriveHeadReg = &HA0
            End If
            .bCommandReg = &HEC
            .bSectorCountReg = 1
            .bSectorNumberReg = 1
        End With
    End With
    
    DeviceIoControl hdh, DFP_RECEIVE_DRIVE_DATA, _
                    bin, Len(bin), bout, Len(bout), br, 0
    
    s = vbNullString
    For ix = hddfr To hddfr + hddln - 1 Step 2
        If bout.bBuffer(ix + 1) = 0 Then Exit For
        s = s & Chr(bout.bBuffer(ix + 1))
        If bout.bBuffer(ix) = 0 Then Exit For
        s = s & Chr(bout.bBuffer(ix))
    Next ix
    
    CloseHandle hdh

    CmnGetHDData = Trim(s)
    
End Function

該文章在 2013/11/14 22:12:18 編輯過
關(guān)鍵字查詢
相關(guān)文章
正在查詢...
點(diǎn)晴ERP是一款針對(duì)中小制造業(yè)的專業(yè)生產(chǎn)管理軟件系統(tǒng),系統(tǒng)成熟度和易用性得到了國(guó)內(nèi)大量中小企業(yè)的青睞。
點(diǎn)晴PMS碼頭管理系統(tǒng)主要針對(duì)港口碼頭集裝箱與散貨日常運(yùn)作、調(diào)度、堆場(chǎng)、車隊(duì)、財(cái)務(wù)費(fèi)用、相關(guān)報(bào)表等業(yè)務(wù)管理,結(jié)合碼頭的業(yè)務(wù)特點(diǎn),圍繞調(diào)度、堆場(chǎng)作業(yè)而開發(fā)的。集技術(shù)的先進(jìn)性、管理的有效性于一體,是物流碼頭及其他港口類企業(yè)的高效ERP管理信息系統(tǒng)。
點(diǎn)晴WMS倉(cāng)儲(chǔ)管理系統(tǒng)提供了貨物產(chǎn)品管理,銷售管理,采購(gòu)管理,倉(cāng)儲(chǔ)管理,倉(cāng)庫(kù)管理,保質(zhì)期管理,貨位管理,庫(kù)位管理,生產(chǎn)管理,WMS管理系統(tǒng),標(biāo)簽打印,條形碼,二維碼管理,批號(hào)管理軟件。
點(diǎn)晴免費(fèi)OA是一款軟件和通用服務(wù)都免費(fèi),不限功能、不限時(shí)間、不限用戶的免費(fèi)OA協(xié)同辦公管理系統(tǒng)。
Copyright 2010-2025 ClickSun All Rights Reserved