讀取軟硬光碟序列號

2022-04-07 07:24:10 字數 974 閱讀 5515

獲取序列號是要讀取軟硬光碟的資訊,可通過以下函式獲得:

public declare function getvolumeinformation lib "kernel32.dll" alias "getvolumeinformationa" (byval lprootpathname as string, byval lpvolumenamebuffer as string, byval nvolumenamesize as integer, lpvolumeserialnumber as long, lpmaximumcomponentlength as long, lpfilesystemflags as long, byval lpfilesystemnamebuffer as string, byval nfilesystemnamesize as long) as long。

現在說明一下這個函式:

它用於獲取序列號,卷標,盤資訊(如:是否壓縮等)以下乙個例子:

先定以乙個呼叫它的自定義函式:

function getitnum(strdrv as string) as long

dim getnum as long

dim rs as long

dim temp1 as string

dim temp2 as string

temp1 = string$(255, chr$(0))

temp2 = string$(255, chr$(0))

rs = getvolumeinformation(strdrv, temp1, len(temp1), getnum, 0, 0, temp2, len(temp2))

msgbox "卷標為:"+temp1

msgbox "序列號為:"+hex(serialnum)

end function

以後使用時就呼叫getitnum("碟符")就可以了!

這樣就可以十分順利的來控制滑鼠了!

讀取硬體序列號

using system using system.collections.generic using system.text using system.management namespace 讀取序列號 獲取硬碟序列號 string hdid managementclass cimobject1...

讀取硬碟序列號

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

C 讀取硬碟的序列號

include include include define dfp get version 0x00074080 define dfp send drive command 0x0007c084 define dfp receive drive data 0x0007c088 pragma pac...