943,863 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 2710
  • C++ RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
May 16th, 2009
1

Re: Ways to get a Computers "ID"

I have found a link:
http://www.codeguru.com/forum/showthread.php?t=249788

I think I will go for checking the BIOS SerialNumber. In the link it seems to fail when doing this on Windows 98 or earlier but if a fail meens an emty string like: "" that will work for my purpose.

They refer to get the BIOS Serial like below but when gooling on that, I am not sure if I can find anything helpful of how to return this serial number.
I use VC++ 2008 Express Edition

C++ Syntax (Toggle Plain Text)
  1. GetBIOSSerial(); //Is this a call, I cant find out if any namespace goes with this
Last edited by Liszt; May 16th, 2009 at 11:12 am.
Reputation Points: 33
Solved Threads: 6
Junior Poster
Liszt is offline Offline
122 posts
since Oct 2008
May 16th, 2009
0

Re: Ways to get a Computers "ID"

I have come up with a code that look like this that is supposed to return the motherboard serialnumber.
The number that is returned is: "123456789000"

I wonder if that really could be correct or perheps do I miss something in the code. I am looking for a unique serial number ?

C++ Syntax (Toggle Plain Text)
  1. ManagementObjectSearcher ^searcher;
  2. ManagementObjectCollection::ManagementObjectEnumerator ^queryEnum;
  3. ManagementBaseObject ^objMgmt;
  4.  
  5. searcher = gcnew ManagementObjectSearcher("SELECT * FROM Win32_Baseboard");
  6.  
  7. ManagementObjectCollection ^queryCollection = searcher->Get();
  8.  
  9. queryEnum = queryCollection->GetEnumerator();
  10.  
  11. while(queryEnum->MoveNext())
  12. {
  13. objMgmt = queryEnum->Current;
  14. MessageBox::Show(Convert::ToString(objMgmt->GetPropertyValue("SerialNumber")));
  15. }
Last edited by Liszt; May 16th, 2009 at 3:04 pm.
Reputation Points: 33
Solved Threads: 6
Junior Poster
Liszt is offline Offline
122 posts
since Oct 2008
May 16th, 2009
0

Re: Ways to get a Computers "ID"

If you post the complete program (or some test code) then we can test it on our computers to see what it returns.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,951 posts
since Aug 2005
May 16th, 2009
0

Re: Ways to get a Computers "ID"

Yes, that would be more than nice.
I think this would be the complete testcode if I dont miss anything out.


I think this would be the complete testcode and see what this MessageBox returns.
You would have to add the reference System::Management in "Add New Reference"

using namespace System::Management;
C++ Syntax (Toggle Plain Text)
  1. ManagementObjectSearcher ^searcher;
  2. ManagementObjectCollection::ManagementObjectEnumerator ^queryEnum;
  3. ManagementBaseObject ^objMgmt;
  4.  
  5. searcher = gcnew ManagementObjectSearcher("SELECT * FROM Win32_Baseboard");
  6.  
  7. ManagementObjectCollection ^queryCollection = searcher->Get();
  8.  
  9. queryEnum = queryCollection->GetEnumerator();
  10.  
  11. while(queryEnum->MoveNext())
  12. {
  13. objMgmt = queryEnum->Current;
  14. MessageBox::Show(Convert::ToString(objMgmt->GetPropertyValue("SerialNumber")));
  15. }



If you post the complete program (or some test code) then we can test it on our computers to see what it returns.
Last edited by Liszt; May 16th, 2009 at 3:44 pm.
Reputation Points: 33
Solved Threads: 6
Junior Poster
Liszt is offline Offline
122 posts
since Oct 2008
May 16th, 2009
0

Re: Ways to get a Computers "ID"

The part I replace most often: is the motherboard(usually in conjunction with PSU). Those thing short out all the time, and now I have piles of them!

So be wary about how you use that. The only reason I can find, to use it is to block suspected bots off something like a MMORPG for a few hours, till the lag drops.
Reputation Points: 888
Solved Threads: 114
Nearly a Posting Virtuoso
MosaicFuneral is offline Offline
1,270 posts
since Nov 2008
May 16th, 2009
0

Re: Ways to get a Computers "ID"

This is true, I am checking for possibilities and in the end, I will be that careful to see what can be possible or it wont be, how to define things etc...
Reputation Points: 33
Solved Threads: 6
Junior Poster
Liszt is offline Offline
122 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: do CopyFile() DeletFile() function throw exception?
Next Thread in C++ Forum Timeline: Please Correct me





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC