VB硬碟序列號 邏輯

2021-04-09 09:00:15 字數 841 閱讀 6889

第乙個是乙個函式,連在一起不要斷開。

第二個是乙個窗體載入的事件,請寫入某個窗體的**中,

private declare function 獲得硬碟序列號 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

private sub form_load()

on error goto err_form_load    

dim aa as long

dim volname as string

dim 硬碟序列號 as long

dim maxlen as long

dim sysflag as long

dim fsysname as string

aa = 獲得硬碟序列號("c:/", volname, 256, 硬碟序列號, maxlen, sysflag, fsysname, 256)

msgbox "c 硬碟序列號(16制): " & hex(硬碟序列號)

exit sub

err_form_load:

end sub  

檢視硬碟序列號

windows下使用diskpart命令 win r鍵執行cmd,進入命令列介面 1.diskpart 2.list disk 檢視有幾塊硬碟 3.select disk 0 選擇第一塊硬碟 4.detail disk 顯示選擇的硬碟詳細資訊 顯示的第一行是硬碟型號,第二行id是序列號。5.若有多塊...

讀取硬碟序列號

pragma hdrstop pragma argsused include include include include hdd.h const word ide atapi identify 0xa1 讀取atapi裝置的命令 const word ide ata identify 0xec ...

獲取硬碟序列號(VC)

說明 經過上百臺計算機測試,ide和sata硬碟可以獲取序列號 scsi硬碟沒有測試環境,無法測試成功與否。請有條件的朋友幫忙測試下,給個訊息,謝謝。虛擬機器上測試不了,不用測試了。ide測試出來全部是0000等數字。網路流傳的版本不少,下下來測試修改了下。include include inclu...