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

How to get Windows Product ID Programmatically

Status
Not open for further replies.

jorma

Programmer
Mar 18, 2002
25
US
Help

I need to a way to get the windows product id programmatically. Seems this is stored in different areas of the registry in windows 95 than in NT and 2000. Is there some MS provided function that will give me this info?

What I'm trying to do is to get some piece of unique info to identify the particular machine I'm running on, I figure the product id in combination with some others will do a decent job. But my app could run on 95/98/NT/2000 and eventually XP, I need some uniform interface to get this info. Isn't these some call which will give me the product id?


thx

jorma
 
The GetVersionEx API will return the operating system you are running. Dependent on the os, you can read the information from the registry. It also returns the version of the os, which gives you something extra to add to your unique string.

Marcel
 
In a random sample of PC's, I found that the Product ID is located in the registry under the following keys:

HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/

Win98 - ./Windows/CurrentVersion/ProductId
NT4.0 - ./Windows NT/CurrentVersion/ProductId
Win2K - ./Windows/CurrentVersion/ProductId

I suspect that all 9x/ME computers would be the same as Win98. I'm not sure about XP though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top