×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Finding hardware info

Finding hardware info

Finding hardware info

(OP)
Does anyone have any good sites on getting info on hardware (ie Bios S/N, Date, Hard drive....)?


Cory M Hicks

RE: Finding hardware info

Check out the Windows API commands (should be located in Platform SDK sections)

Karl
kb244@kb244.8m.com

Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML, ASP(somewhat), QBasic(least i didnt start with COBOL)

RE: Finding hardware info

(OP)
Would the line:
MsgBox (GetObject("WinMgmts::Win32_LogicalDisk='C:'").VolumeSerialNumber)

Display the correct info on the HDD C: ?

RE: Finding hardware info

is that C++, or VB?

Karl
kb244@kb244.8m.com

Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML, ASP(somewhat), QBasic(least i didnt start with COBOL)

RE: Finding hardware info

(OP)
It should be VC++ but I relaize that is a VB call. Any ideas how to do something similar in VC++?

RE: Finding hardware info

well any main windows API commands are usally located in windows.h, and usally dont require that you create an object, unless its a structure that the command needs to store the retreived information into. It should seem like any other functions in VC++, only difference is if, you never seen an API Call, you'd be surpirsed how many parameters might be needed, or some of the weird parameter types you pass. If you have the MSDN libraries check there. (if you dont, which you should have it if you own VC++, you can always view the whole library online at msdn.microsoft.com)

Karl
kb244@kb244.8m.com

Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML, ASP(somewhat), QBasic(least i didnt start with COBOL)

RE: Finding hardware info

(OP)
I have the MSDN libaries here but I cannot find what I am looking for. I usually use the online ones though because they are usually the most up to date. Can you point me in the right direction on this one?

Cory

RE: Finding hardware info

On the MSDN online library, goto Platform SDK, Win32 API, OverView Of the Win32 API, Base Services, and when you click that you'll see a list of different catagories for API Commands, which contain things like Device Input/Ouput, Registry(you can find hardware information throught the registry as well) , etc

Karl
kb244@kb244.8m.com

Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML, ASP(somewhat), QBasic(least i didnt start with COBOL)

RE: Finding hardware info

(OP)
I am still having trouble finding a way to access the information. If I could find an example it would be most helpful. For some reason specific information on this subject seems hard to find.

RE: Finding hardware info

I think its because most software does not access specific hardware information that is usally not useful, unless the software that's trying happens to be the operating system itself, one of the major fields of software coverage seems to be internet or bussiness related. Maybe by monday I might find some information.

Karl
kb244@kb244.8m.com

Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML, ASP(somewhat), QBasic(least i didnt start with COBOL)

RE: Finding hardware info

(OP)
Hi Karl,

Did you find the info I was looking for after?

Cory

RE: Finding hardware info

I found this at vb-world in the Win32 API section of tips. I know its Visual Basic, but since its an API Call you should be able to easily port it over to VC++ (since you dont even have to make an API declaration like in VB)

here it is:


How can I retrieve a disk's serial number?

Whenever a disk is formatted, the operating system writes a serial number onto it. This number is not guaranteed to be unique, but as it is a 32 bit integer it is unlikely to find a duplicate! The number is often used as part of a copy protection system. This tip shows you how to retrieve the number.

Declarations

Copy this code into the declarations section of the project.

Private Declare Function GetVolumeInformation Lib _
"kernel32.dll" Alias "GetVolumeInformationA" (ByVal _
lpRootPathName As String, ByVal lpVolumeNameBuffer As _
String, ByVal nVolumeNameSize As Integer, _
lpVolumeSerialNumber As Long, lpMaximumComponentLength _
As Long, lpFileSystemFlags As Long, ByVal _
lpFileSystemNameBuffer As String, ByVal _
nFileSystemNameSize As Long) As Long

Code

Function GetSerialNumber(strDrive As String) As Long
    Dim SerialNum As Long
    Dim Res As Long
    Dim Temp1 As String
    Dim Temp2 As String
    Temp1 = String$(255, Chr$(0))
    Temp2 = String$(255, Chr$(0))
    Res = GetVolumeInformation(strDrive, Temp1, _
    Len(Temp1), SerialNum, 0, 0, Temp2, Len(Temp2))
    GetSerialNumber = SerialNum
End Function
Use

An example of using the above function:

Call MsgBox GetSerialNumber("C:")
This will bring up a message box with the serial number of the C drive.


Karl
kb244@kb244.8m.com

Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)

RE: Finding hardware info

(OP)
Thanks Karl,

I found a similar article about a week or so ago on how to do the same thing.

Thanks

Cory

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close