For the moment I am getting the computers name with this code, but perheps there could be others and better ways to get a computers unique "ID".
I am searching for a way to identify a computer so a software can recognice that computer in order to work.

The very best way should be a way where that Unique "ID" just cant be changed because that specific "ID" is used by other recources and systemfiles of the computer, to make things work.

SystemInformation::ComputerName;

You could use your hard drives serial number as a unique ID as you probably won't be removing it or you could use your MAC Address from the installed network interface card (NIC) however i would recommend using ther hard drive serial number as you can have more than one NIC and it is more likely to be changed than your hard drive

as you can have more than one NIC and it is more likely to be changed than your hard drive

Computers can also have multiple hard drives. And I've changed hard drives more frequently than NICs. Possibly there is some unique ID in the bios that can be retrieved, I don't know.

Yes, that is true, myself I have 4 harddrives actually :) but the idéa was interesting anyway.. I will start search for methods and see what I can come up with.

Computers can also have multiple hard drives. And I've changed hard drives more frequently than NICs. Possibly there is some unique ID in the bios that can be retrieved, I don't know.

Computers can also have multiple hard drives. And I've changed hard drives more frequently than NICs.

To be honest you're right I think what I meant is get the ID of some piece of hardware you don't intend on changing and that can be the identifier.
You could also generate some unique ID and keep it in a text file. Then check the location you put it for the unique ID.

>>I am searching for a way to identify a computer so a software can recognice that computer in order to work.

There really is no idiot-proof way to prevent someone from doing that. Its just like encryption code -- it only works for the novice. A good hacker could probably break any method you try to use.

So, over a period of a couple of years, I do
- upgrade the RAM
- replace the hard disk
- replace the graphics card
- replace the NIC
- replace the motherboard and processor.

Do I still have the same machine?

Overly elaborate "machine locked" software only really serves to piss off genuine customers who paid for it, only to be met with abuse from the s/w vendor when they've "upgraded" the wrong thing.
The last thing you need is paying customers taking their business somewhere else!

People who pirate your s/w were going to pirate it anyway. Any s/w which is vaguely useful will be cracked (and with the internet, can be found by anyone willing to look).

You might be better served by spending your time on improving the features, and removing the bugs, so that more genuine people would want to buy it.
As opposed to spending time and money on people who were never going to give you any money to begin with.

"Nice security system, shame about the program" is all to common.

Or change your business model so you give the s/w away and you sell service to those that want it. The program in effect becomes an interactive advert for what you're really selling, and which is a lot harder to rip-off.

commented: Wow, I just buy a new computer then :) +4

Yes that is true, I really understand the problem with this, as Ancient said a good hacker have thought about ´all´ the possible ways.
I might just choose a way and wait for it to be cracked :P
As I have seen you can almost search for any software out there and find cracked versions.

We can just hope for some honest people who like the feeling to buy it as it should be. I wonder what the statistic is for that :)

You could get the computer's hard disk ID (hardware key), you can find some source code on how to do this here, but as already said the user can always replace a 'dead' part in his computer, so dealing with a unique computer ID will be way more difficult than it looks like on the first sight :)

I'm still mystified why people even bother to protect most software. When its lifespan/popularity will probably be to short to ever see a revenue drop, due to piracy.

You could get the computer's hard disk ID (hardware key)

Quick few interrupts, yes. But I suffer hard-drive failure, all the time.

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

GetBIOSSerial(); //Is this a call,  I cant find out if any namespace goes with this
commented: Finally someone which uses Google :) +4

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 ?

ManagementObjectSearcher ^searcher;  
ManagementObjectCollection::ManagementObjectEnumerator ^queryEnum;  
ManagementBaseObject ^objMgmt;  
  
searcher = gcnew ManagementObjectSearcher("SELECT * FROM Win32_Baseboard");  
  
ManagementObjectCollection ^queryCollection = searcher->Get();            
              
queryEnum = queryCollection->GetEnumerator();  
  
while(queryEnum->MoveNext())
{  
    objMgmt = queryEnum->Current;  
    MessageBox::Show(Convert::ToString(objMgmt->GetPropertyValue("SerialNumber")));  
}

If you post the complete program (or some test code) then we can test it on our computers to see what it returns.

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;

ManagementObjectSearcher ^searcher;  
ManagementObjectCollection::ManagementObjectEnumerator ^queryEnum;  
ManagementBaseObject ^objMgmt;  
  
searcher = gcnew ManagementObjectSearcher("SELECT * FROM Win32_Baseboard");  
  
ManagementObjectCollection ^queryCollection = searcher->Get();            
              
queryEnum = queryCollection->GetEnumerator();  
  
while(queryEnum->MoveNext())
{  
    objMgmt = queryEnum->Current;  
    MessageBox::Show(Convert::ToString(objMgmt->GetPropertyValue("SerialNumber")));  
}

If you post the complete program (or some test code) then we can test it on our computers to see what it returns.

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.

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...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.