Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get Hard disk information from vb6

Status
Not open for further replies.

dipgohil79

Programmer
Jun 14, 2002
17
IN
hi to ALL
I want to use the Hard disk Information like serial no., free space, used space, No. of partitions, Etc.

How I can get this information using my vb6 application?
 
Alternately, see the following threads.
thread222-780295
thread222-527477

To get a list of all disk drives, place a DriveListBox on your form or use GetLogicalDriveStrings API function.
To identify removable and fixed drives, use GetDriveType API function.
 
You can add an "about box" control to your project, and shamelessly steal the API code that Microsoft was kind enough to provide.

"Don't be irreplaceable. If you can't be replaced, you can't be promoted."
 
TO genomon
I just want to catch the hard disk information not all the system information. can u tell me other way to do it?
 
Have you looked at the Drive object of the Drive class in object browser?

"Don't be irreplaceable. If you can't be replaced, you can't be promoted."
 
TO genomon
i am sorry to say but in my Vb6 Object browser there is no "Drive class". if you can attach sample code for this then it will be best help for me.

 
Add a project reference to the Microsoft Scripting Runtime library; then look up "Drive" after selecting "All Libraries" in Object Browser. Here is a MSDN link on how the File System & Drive objects work:

"Don't be irreplaceable. If you can't be replaced, you can't be promoted."
 
TO genomon

Thank you very much for your help. now i can read my drive serialnumber and all the stuff. but I have one more Question : I have 3 Partition on my hard disk, Can i find the serial number of the physical harddrive? that is i think unique for harddisk....

many thanks for the quick response onceagain. [2thumbsup]

 
Sorry I can't help there; did you look at hypetia's link above?
thread222-780295: Harddisk serial number

"Don't be irreplaceable. If you can't be replaced, you can't be promoted."
 
> but I have one more Question

Um, as genomon suggests, did you actually look at any of the other links provided to you in this thread? They provide at least 3 ways of getting the volume serial number (an API call, a WMI property and a filesystemobject property)

>that is i think unique for harddisk....

Sadly, no.

It is quite difficult to obtain the physical, manufacturer's serial number (in vague theor WMI's Win32_PhysicalMedia object should allow you to retrieve it, but not all drives are return a value). All the solutions here provide a volume serial number, which isn't the same thing at all
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top