Solved

Generate Serial Number for my Program

Posted on 2012-04-05
2
534 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
ID: 37814868
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
ID: 37814928
Great solution, JKR. This solution never occurred to me.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
undefined reference to `bswap_128' 9 159
Header of docx file 17 102
What is sub-make ? 2 58
Android development question 2 34
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…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

806 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