Mega Code Archive

 
Categories / Delphi / Examples
 

Getdiscserno

Is there any way to get the Harddisk serial number with CB3 + Windows? HAVING TRIED TO MAKE CODE SNIPPETTS BELOW WORK, (WITH NO SUCCESS) BE PREPARED FOR SOME EXTRA EFFORT BEFORE YOU'RE SUCCESSFUL HERE... ******************************************** This is an example of API GetVolumeInformation. const int BUFFER_SIZE=100; char disk[]="C"; char DiskName[BUFFER_SIZE]; unsigned logn DiskSerNum; GetVolumeInformation((disk ,DiskName ,BUFFER_SIZE ,&DiskSerNum ,NULL ,NULL ,NULL ,NULL); Hope that helps, Steven Carlson In article <6i0sfd$6gv2@forums.borland.com>, "News IMPSAT" <ne1@usa.net> wrote: ******************************************** look in the on-line help === >GetVolumeInformation The GetVolumeInformation function returns information about a file system and volume whose root directory is specified. BOOL GetVolumeInformation(LPCTSTR lpRootPathName, // address of root directory of the file system LPTSTR lpVolumeNameBuffer, // address of name of the volume DWORD nVolumeNameSize, // length of lpVolumeNameBuffer LPDWORD lpVolumeSerialNumber, // address of volume serial number LPDWORD lpMaximumComponentLength, // address of system's maximum filename length LPDWORD lpFileSystemFlags, // address of file system flags LPTSTR lpFileSystemNameBuffer, // address of name of file system DWORD nFileSystemNameSize // length of lpFileSystemNameBuffer); ******************************************** In Windows you should use the API GetVolumeInformation function. For example: const int BUFFER_SIZE=100; char disk[]="C"; char DiskName[BUFFER_SIZE]; unsigned long DiskSerNum; GetVolumeInformation((disk ,DiskName , BUFFER_SIZE ,&DiskSerNum ,NULL, NULL, NULL, NULL);