adspace
Answer Posted / Dharmendra Singh Shishodia
To get the serial number of a drive in Delphi, you can use the GetVolumeInformation function from the Windows API. Here's an example:nn```delphinfunction GetDriveSerialNumber: string;nbeginn tryn declaren pVolInfo : TWin32_Volume_DISK_DRIVE_INFO;n lBufferSize : DWORD;n lReturnLength : DWORD;n constn dwBufSize : DWORD = SizeOf(pVolInfo);n n if GetVolumeInformation(@a, nil, 0, pVolInfo, dwBufSize, lBufferSize, lReturnLength, nil) thenn Result := PChar(pVolInfo.VolumeSerialNumber);n elsen RaiseLastOSError;n exceptn on E: Exception don Result := E.Message;n end;nend;
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to Print in Delphi without using the TPrinter Unit ?
How can one prevent a TForm from being moved or resized?
How to Determine the last access time of a given file ?
How to Change the default width/height of the editor?
How to Change the owner of a component at runtime ?
How to Get the time and date in Universal Time ?
How to Remove drives listed in a TDriveComboBox ?
How to Create resource files?
How to Save a QuickReport custom preview to text?
How to Flush binary file from disk cache to disk ?
How to Retrieving the program that is associated with a given extension?
How to Retrieve the line number that a memo's cursor is on?