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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding hardware info 1

Status
Not open for further replies.

SmileeTiger

Programmer
Mar 13, 2000
200
US
Does anyone have any good sites on getting info on hardware (ie Bios S/N, Date, Hard drive....)?<br><br><br>Cory M Hicks
 
Check out the Windows API commands (should be located in Platform SDK sections) <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>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)
 
Would the line:<br>MsgBox (GetObject(&quot;WinMgmts::Win32_LogicalDisk='C:'&quot;).VolumeSerialNumber)<br><br>Display the correct info on the HDD C: ?
 
is that C++, or VB?<br> <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>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)
 
It should be VC++ but I relaize that is a VB call. Any ideas how to do something similar in VC++?
 
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) <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>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)
 
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?<br><br>Cory
 
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 <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>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)
 
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.
 
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. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>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)
 
Hi Karl,<br><br>Did you find the info I was looking for after?<br><br>Cory
 
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)<br><br>here it is:<br><br><FONT FACE=monospace><br><b>How can I retrieve a disk's serial number?</b><br><br>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.<br><br><i><b>Declarations</b></i><br><br>Copy this code into the declarations section of the project.<br><br>Private Declare Function GetVolumeInformation Lib _<br>&quot;kernel32.dll&quot; Alias &quot;GetVolumeInformationA&quot; (ByVal _<br>lpRootPathName As String, ByVal lpVolumeNameBuffer As _<br>String, ByVal nVolumeNameSize As Integer, _<br>lpVolumeSerialNumber As Long, lpMaximumComponentLength _<br>As Long, lpFileSystemFlags As Long, ByVal _<br>lpFileSystemNameBuffer As String, ByVal _<br>nFileSystemNameSize As Long) As Long<br><br><i><b>Code</b></i><br><br>Function GetSerialNumber(strDrive As String) As Long<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim SerialNum As Long<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim Res As Long<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim Temp1 As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim Temp2 As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Temp1 = String$(255, Chr$(0))<br>&nbsp;&nbsp;&nbsp;&nbsp;Temp2 = String$(255, Chr$(0))<br>&nbsp;&nbsp;&nbsp;&nbsp;Res = GetVolumeInformation(strDrive, Temp1, _<br>&nbsp;&nbsp;&nbsp;&nbsp;Len(Temp1), SerialNum, 0, 0, Temp2, Len(Temp2))<br>&nbsp;&nbsp;&nbsp;&nbsp;GetSerialNumber = SerialNum<br>End Function<br>Use<br><br><i><b>An example of using the above function:</b></i><br><br>Call MsgBox GetSerialNumber(&quot;C:&quot;)<br>This will bring up a message box with the serial number of the C drive.<br><br></font><br> <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>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)
 
Thanks Karl,<br><br>I found a similar article about a week or so ago on how to do the same thing. <br><br>Thanks<br><br>Cory
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top