How to return BIOS serial number

This is a discussion on How to return BIOS serial number within the C++ Programming forums, part of the General Programming Boards category; How would it be possible to return the BIOS serial number or perheps better the motherboard serial number. I have ...

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    383

    How to return BIOS serial number

    How would it be possible to return the BIOS serial number or perheps better the motherboard serial number.
    I have googled for hours but cant find an example of this that fits with VC++ 2008 Express Edition.

    Any idéas will be helpful..
    Last edited by Coding; 05-16-2009 at 09:20 AM.

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    60
    suggest make use of WMI script

    Code:
    SELECT * FROM Win32_BIOS

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    383
    Yes, I have found something like this. It is originally a C# code that I am trying to convert to C++ but I have problem to understand when it comes to foreach wich is a C# code that does´nt exist in C++.

    Code:
    String^ s = "SELECT SerialNumber FROM WIN32_BaseBoard";
    System::Management::ManagementObjectSearcher^ oWMI = gcnew System::Management::ManagementObjectSearcher(s);
    System::Management::ManagementObjectCollection^ oSerialNumbers = oWMI->Get();
    
    
    //How can I convert this to C++ also
    
    //foreach (System.Management.ManagementObject mo in oSerialNumbers)
    //{
    //Console.WriteLine("Serial Number: " +
    //mo.Properties["SerialNumber"].Value.ToString());
    //}

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,411
    foreach just loops from the start to the end of an object, kind of like:
    for (int i = 0; i < n; n++)
    Of course, what start and end is and means depends on the object it's looping over.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User
    Join Date
    Dec 2007
    Posts
    383
    Yes, thank you.. I thought about something like that also.

    I did something like this. As I understand the oSerialNumbers contains objects but I dont know how I will convert them to Strings.
    I am not really sure what I have to do inside that loop.

    Code:
    for int i = 0; i < oSerialNumbers->Count; i++ )
    {
    
         //?
    
    }

  6. #6
    Registered User
    Join Date
    Dec 2007
    Posts
    383
    I am trying to do something like this but I know I dont pass the oSerialNumbers in any way:

    Code:
    for( int i = 0; i < oSerialNumbers->Count; i++ )
    {
           System::Management::ManagementObject^ mo = gcnew System::Management::ManagementObject();
    	
           MessageBox::Show(mo->Properties["SerialNumber"]->Value->ToString());
    
    }
    I cant do like this:
    Code:
    System::Management::ManagementObject^ mo = gcnew System::Management::ManagementObject(oSerialNumbers[i]);
    Last edited by Coding; 05-16-2009 at 11:36 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Link List math
    By t014y in forum C Programming
    Replies: 17
    Last Post: 02-20-2009, 05:55 PM
  2. how to combine these working parts??
    By transgalactic2 in forum C Programming
    Replies: 0
    Last Post: 02-01-2009, 07:19 AM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  5. DOS, Serial, and Touch Screen
    By jon_nc17 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-08-2003, 03:59 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21