Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to get CPU ID?

Posted on 1999-09-08
6
Medium Priority
?
543 Views
Last Modified: 2010-04-16
How to get the CPU ID and display it in a text control when I started my VC++ program?

Notice the CPU ID I mean here is like the host ID in UNIX which was generated with the command "hostid".

Thanks!
0
Comment
Question by:philliplu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 2030900
There is no such ID in windows.  If you are on a network, the network card has a unique ID.
0
 
LVL 6

Expert Comment

by:graham_k
ID: 2032602
you can also get the hard drive Id.  This is often used for seding the random number generator, or generating a unique user Id.  Perhpas you could tell us what you are trying to achieve?
0
 
LVL 2

Expert Comment

by:iarla
ID: 2091626
You can use the IP address of the machine if you are on a network and convert that to a hexadecimal number.
 
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 1

Accepted Solution

by:
jhattingh earned 200 total points
ID: 2106122
There is no such id. If you want to protect software or generate a unique ID, use the volume serial number:

      char lpszVolumeName[255];
      char lpszFileSystemName[255];
      DWORD dwFlags=0, dwSerialNo = 0;
      LPCTSTR lpszPath = "C:\\";
      DWORD dwMaxLength=0;

      if (GetVolumeInformation("C:\\", lpszVolumeName, 255, &dwSerialNo, &dwMaxLength, &dwFlags, lpszFileSystemName, 255))
      {
            m_strSerialNo.Format("Serial No:\n%d", dwSerialNo);
            UpdateData(FALSE);
      }
0
 
LVL 2

Expert Comment

by:iarla
ID: 2106177
It think the best approach to use is to generate a
CLSID for each machine. You can put it somewhere in the registry. The CLSID will ensure uniqueness because it based on a OSF DCE algorithm.
0
 

Author Comment

by:philliplu
ID: 2116358
Thank you very much!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question