Solved

Generate Serial Number for my Program

Posted on 2012-04-05
2
531 Views
Last Modified: 2012-04-05
I am trying to figure out the best way for users to "register" the program I am writing.

Here are my simple guidelines:

1. The program should be able to be registered without an internet connection.

2. The registration dialog box consists of a USERNAME and SERIAL NUMBER edit control.


I would like some high level suggestions on how to make sure the serial number is unique to each user BASED upon their USERNAME.

Of course we have some CONSTANTS I have available to me, for each user, which could be used to generate the final serial number.

a. hard drive serial
b. time info ( day, month, etc )
c. other WIN32 api return values that are consistent....

So, I would like some ideas on a simple algorithm based on the username.

All sincere suggestions will receive points.

I would LOVE a solution (suggestion) that I could actually put into production - not necessarily code, but a detailed suggestion - KEEP IN MIND PLEASE, I am only an intermediate C++ programmer, lol.

THANKS!!
0
Comment
Question by:edvinson
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
Comment Utility
If you are after a unique serial number based on the user's machine, try a GUID:

#include <objbase.h>
#include <stdio.h>

#pragma comment(lib,"ole32.lib")

void GenerateGUID(char* pBuf) {

  GUID guid;
  ::CoInitialize(0);
  ::CoCreateGuid(&guid);

  sprintf(pBuf,"{%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X}",
        guid.Data1, guid.Data2, guid.Data3,
        guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
        guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);

  CoUninitialize();
}

Open in new window

0
 
LVL 1

Author Closing Comment

by:edvinson
Comment Utility
Great solution, JKR. This solution never occurred to me.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now