create keygen yourself.docx

download create keygen yourself.docx

of 1

Transcript of create keygen yourself.docx

  • 7/30/2019 create keygen yourself.docx

    1/1

    @@@@How To Make a Keygen In Visual Basic@@@@

    Most commercial software uses some form of random keys to authenticate and register a legitimate copywhen the program is installed. Commonly this is a series of random letters grouped in varying numbers ofletters. For example, you might see this sequence: DXUWB-GPHQE-CCNYQ- QFHAT-ZFBLO on alicensedprogram. Specialized software called Key Generators, or KeyGen creates these codes, but you can

    make your own using only 16 lines of Visual Basic code. Start a new project in Visual Basic, selecting the"Standard.EXE" template from the list offered under "File" and "New Project." Click on "File," "SaveProject As" and name both the form and project "MyKeyGen" when prompted. Add a"CommandButton"control to the open form by double clicking this control in the Toolbox on the left of your screen. This

    control is an icon shaped like a small rectangle. Normally it is the third control down in the right handcolumn ofthe ToolBox. Add a label to the form in the same way. The label icon is a large letter "A" in the

    toolbox. Click on the new"Command1 " button now on the form to focus on its properties in the "Properties" panel on the right. Double click on the "(Name)"property to highlight the default name,"Command1. " Change this name to "KeyGen". Click on the caption property and change it to"Generate

    Key". Click on the new Label1 on the form and make these changes to its properties: Delete the Captionname. Scroll down in the properties list until you find "Height" and change this to 500. Scroll to the

    bottom of the properties and change the"Width" to 1200. Click on "View" in the main Visual Basic menuat the top and chose "Code." This opens the Code window where you should type these lines exactlyas

    they appear: Option Base 1 Option Explicit Private Sub KeyGen_Click() Dim n As Integer Dim KeyGen(26) As Long Dim NewKey, FinalKey As String Randomize For n = 1 To 26 KeyGen(n) = Int(Rnd * 26) +1 KeyGen(n) = KeyGen(n) + 64 NewKey = Chr$(KeyGen (n)) FinalKey = FinalKey + NewKeyNextFinalKey = Left (FinalKey, 5) + "-" + Mid ( FinalKey, 6 , 5) + "-" + Mid (FinalKey, 11 , 5) + " -" +Mid (FinalKey, 17 , 5) Label1. Caption = FinalKey End Sub Save the project by clicking on "File" and "Save Project." Press "F5 " to run the program. The declarations in the lines beginning "Dim" specifyhowthe program variables are used. " KeyGen (26) " creates an array of variables with 26 possibilitiesandthe "Option Base 1 " ensures the first of the 26 is numbered one. " Randomize" generates a newrandom seed each time the program runs. The rest of the lines create a series of random numbers, whichare then converted to letters. Since ASCII code for the alphabet begins withASCII 65 , we have to add 64to each random number before the conversion. In the end, a list of four sets of random letters separatedby hyphens is created and displayed in the label box. Tips and Warnings If you need a longer series ofkey letters, add anadditional segment to the end of the line beginning "Final Key = Left(Finalkey,5) ".Insert at the endof this line the following code: +"-" + Right (FinalKey,5) To create four letter sequences,or vary the number of letters in each group, change the fives in the FinalKey line to other numbers. Usingarrays can be tricky, particularly when you set a limit on the maximum number and use repeatingsequences. If you get a message "Run-time error 9 , subscript out of range," you entered a largernumber in one ofthe lines than the array can hold.

    ~~/\h!h Pr!@rh!