SerialNum : pdword; a, b : dword; Buffer : array [0..255] of char; begin result := ""; if GetVolumeInformation(PChar(diskchar+":\"), Buffer, SizeOf(Buffer), SerialNum, a, b, nil, 0) then Result := IntToStr(SerialNum^);
end;
2.检查磁盘是否就绪
Function DiskReady(Root: string) : Boolean;
var
Oem : CARDINAL ; Dw1,Dw2 : DWORD ;
begin
Oem := SetErrorMode( SEM_FAILCRITICALERRORS ) ;
if LENGTH(Root) = 1 then Root := Root + ":\\" ; Result := GetVolumeInformation( PCHAR( Root ), NIL,0,NIL, Dw1,Dw2, NIL,0 ) ; SetErrorMode( Oem ) ;