procedure TForm1.Button1Click(Sender: TObject);
var
RootPath: array[0..20] of Char; // holds the root directory name
VolName: array[0..255] of Char; // holds the volume name
SerialNumber: DWORD; // holds the serial number
MaxCLength: DWORD; // holds the maximum file component length
FileSysFlag: DWORD; // holds file system flags FileSysName: array[0..255] of Char; // holds the name of the file system
begin
{indicate information is to be retrieved from the C drive}
RootPath := 'C:\'; {retrieve the volume information}
GetVolumeInformation(RootPath, VolName, 255, @SerialNumber, MaxCLength,
FileSysFlag, FileSysName, 255); {display the information}
Panel2.Caption := VolName;
Panel3.Caption := IntToHex(SerialNumber,8); Panel4.Caption := FileSysName;
end;
var
RootPath: array[0..20] of Char; // holds the root directory name
VolName: array[0..255] of Char; // holds the volume name
SerialNumber: DWORD; // holds the serial number
MaxCLength: DWORD; // holds the maximum file component length
FileSysFlag: DWORD; // holds file system flags FileSysName: array[0..255] of Char; // holds the name of the file system
begin
{indicate information is to be retrieved from the C drive}
RootPath := 'C:\'; {retrieve the volume information}
GetVolumeInformation(RootPath, VolName, 255, @SerialNumber, MaxCLength,
FileSysFlag, FileSysName, 255); {display the information}
Panel2.Caption := VolName;
Panel3.Caption := IntToHex(SerialNumber,8); Panel4.Caption := FileSysName;
end;
解决方案 »
- 请教:如何模拟点击一个窗口的任意一个位置?这个窗口是外部程序的一个弹出对话框。
- 树图怎么得到选择的结点的在第几层上?
- 外部程序调用中的问题
- 请问怎样改变BMP的颜色?
- 求《Mastering Delphi 5》的英文电子书
- 错误提示“Asynchronous socket error”可以在哪里得到祥解?
- 请问怎样得到一个文件夹下的最早文件和最新文件的名字(不要用FindNext)?
- 急急急!!!我想做一个对指定的网页填写数据的程序,请问如何编写?如何实现?用什么原理?(高分相赠!!)
- 如何进行PageControl1控件内部的页面切换?
- 请教诸位,加载的DLL如何从内存中卸载掉?(except reboot)
- 在serversocket中如何用IP地址实现消息转发?急!!!!!!!!
- 我回答了大家这么多问题,你们也应该帮帮我的忙吧!!!
注:如果返回值为'0000-0000',则未检测到。
function GetHDSerialNumber(Drv : String): String;
var
VolumeSerialNumber : DWORD;
MaximumComponentLength : DWORD;
FileSystemFlags : DWORD;
begin
if Drv[Length(Drv)] =':' then Drv := Drv + '\';
GetVolumeInformation(pChar(Drv),
nil,
0,
@VolumeSerialNumber,
MaximumComponentLength,
FileSystemFlags,
nil,
0);
Result := IntToHex(HiWord(VolumeSerialNumber), 4) +
'-' +
IntToHex(LoWord(VolumeSerialNumber), 4);
end;
给个例子你吧!