读取软硬光盘序列号

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 shawls 的 blog

 

读取软硬光盘序列号

获取序列号是要读取软硬光盘的信息,可通过以下函数获得:
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("盘符")就可以了!
这样就可以十分顺利的来控制鼠标了!

本文关键:序列号
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top