HOME

Sunday, September 4, 2011

How to make a Keygen with C++ [and a bit of C# & VB]


Keygen Tutorial

Steps:
...
1. Download & Install Microsoft Visual C++ Express (2008 - 2010)
[Get the trial off microsoft official website and to keep it for more than 30 days, delete the registration folder in regedit]

2. Start a new project, name it, and select "Windows Forms Application".

3. Select the size of your keygen form and then right click it, properties and on FormBorderStyle, select None.
[This is used to remove the titlebar and windows margins.



4. A little bit below, turn "Maximise/Minimise Box" and "Control Box" to false. Topmost must be true if you want your keygen to always stay on top of other windows.
[Other options such as "Show icon/Show in taskbar" are self explainatory, so set to false if you wish]

5. Now you can start designing your keygen. Either make a "Background Image" on your form1 or from the "toolbox" {look for a hammer icon above} add a "PictureBox". To add an image, click the arrow above the dragged box and "Choose Image", then once selected you can stretch it.

6. You can add labels for text, a progress bar... buttons, text box [this will have your generated serial] and so on, use your imagination.

7. Everything you add pretty much has a "Properties" option which like Form1, you can edit stuff in it.

8. To add music to your keygen, you have two methods. There will be a bit of C# or Visual Basic here but it's easy enough. For implemented music, check this out http://msdn.microsoft.com/en-us/library/...S.85).aspx
If you want to skip this, then make a WebBrowser control, make it small and invisible. Put the url to a youtube website or whatever has music to it and it will begin automatically.

9. Animations are simply added by using a .gif file in your picture box instead of a bitmap/jpg.

10. To make your buttons work, just make an event (double click button until you are taken to the code).
Now there are a few paths you can take for this to generate serials. Let's assume this is the [ Generate ] button.

The way I know so far is below: [You MUST have a "TextBox" so that the below will get generated in it visually]



Code:
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
srand((unsigned)time(0));
int number;
number = (rand()%7)+1;

if (number == 1)
this->richTextBox1->Text = L"XXXX - XXXX - XXXX - XXXX - XXXX";
else
if (number == 2)
this->richTextBox1->Text = L"XXXX - XXXX - XXXX - XXXX - XXXX";
else
if (number == 3)
this->richTextBox1->Text = L"XXXX - XXXX - XXXX - XXXX - XXXX";
else
if (number == 4)
this->richTextBox1->Text = L"XXXX - XXXX - XXXX - XXXX - XXXX";
else
if (number == 5)
this->richTextBox1->Text = L"XXXX - XXXX - XXXX - XXXX - XXXX";
else
if (number == 6)
this->richTextBox1->Text = L"XXXX - XXXX - XXXX - XXXX - XXXX";
else
if (number == 7)
this->richTextBox1->Text = L"XXXX - XXXX - XXXX - XXXX - XXXX";
}

This just makes a variable generate on random from 1 - 7 and each one will have a specific serial.
The code above requires two headers for the script to work :
#include
#include

11. Now that you don't have a control or titlebar, it's most likely you must have a way to exit the application. Use this->Close(); on your [ Exit ] button event.

12. The rest is up to yourself and your creativity, add colours and so on.
F7 to compile, CTRL + F5 to test, and to finish it up in an EXE, select RELEASE below the "Tools"window and compile.

No comments:

Post a Comment