|
下面就利用Micosoft 的Visual Basic6.0来完
成这项设计工作。需要利用几个Windows的API函数:GetVolumeInformation用以获
得硬盘的序列号、GetPrivateProfileString、WritePrivateProfileString用来读
写INI文件。对于以上三个API函数的使用不作介绍了,现将其声明如下:
Private Declare Function GetVolumeInformation 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 Declare Function
GetPrivateProfileString Lib ″kernel32″ Alias ″
GetPrivateProfileStringA″ (ByVal lpApplicationName As String, ByVal
lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As
String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileString Lib ″kernel32″
Alias ″WritePrivateProfileStringA″ (ByVal lpApplicationName As String,
ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As
String) As Long
以上这些声明放在窗体的“通用”中即可。
哪里出错了,请大神指导!谢谢
|
|