[ActiveLock-Development] CVS: activelock/tutorials/vb BasicTutorial.html,1.1,1.2
Brought to you by:
ialkan
From: Thanh H. T. <th...@us...> - 2003-11-26 06:43:16
|
Update of /cvsroot/activelock/activelock/tutorials/vb In directory sc8-pr-cvs1:/tmp/cvs-serv30695 Modified Files: BasicTutorial.html Log Message: Updated with VB.Net instructions and corrections - by Dan Keeley Index: BasicTutorial.html =================================================================== RCS file: /cvsroot/activelock/activelock/tutorials/vb/BasicTutorial.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- BasicTutorial.html 26 Nov 2003 05:57:00 -0000 1.1 +++ BasicTutorial.html 26 Nov 2003 06:43:12 -0000 1.2 @@ -66,12 +66,12 @@ <li><a href=#step5>Step 5: License Registration</a> <li><a href=#step6>Step 6: Let's Get A Little More Advanced</a> <li><a href=#resources>Resources</a> + <li><a href=#revhistory>Revision History</a> </ul> <a name="disclaimer"><h2>Disclaimer</h2></a> <blockquote> -<pre> -USE OF ACTIVELOCK 2 TUTORIALS IS ENTIRELY AT YOUR OWN RISK! +<pre>USE OF ACTIVELOCK 2 TUTORIALS IS ENTIRELY AT YOUR OWN RISK! THE INFORMATION IN THESE TUTORIALS ARE PROVIDED "AS IS" WITHOUT WARRANTY, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ARISING FROM @@ -108,8 +108,8 @@ <li>Click the <b>Generate</b> button to generate the Product Keys. <li>When the Product VCode and GCode generation process is complete, click <b>Add To Product List</b> button to add/save the product into the product database, to be used later for license key generation. - <li>Make note of the generated VCode. You will use this code later within your application. - <img src="images/alugen.jpg"><br> + <li>Make note of the generated VCode. You will use this code later for the "SoftwareCode" within your application. + <img src="images/alugen.jpg" width="590" height="404"><br> Note that because of its length, the complete code may not be fully visible in the text box. You'll need to double-click on the text box and do a Ctrl-C operation if you want to copy the entire code. </ol> @@ -122,8 +122,9 @@ <li>Open your .vbp project in VB, and then select <b>References</b> from the <b>Project</b> menu. <li>Scroll down on the list until you see <b>ActiveLock Object Library 2.0</b>, - then select by clicking on the empty checkbox beside it. - <img src="images/addref.jpg"> + then select by clicking on the empty checkbox beside it. Note: If you dont have that exact library + then check you've installed the latest version of Activelock. + <img src="images/addref.jpg" width="449" height="357"> </ol> </blockquote> @@ -133,15 +134,13 @@ <ol> <li>Somewhere within your app, declare an object reference to ActiveLock2.IActiveLock. <blockquote> - <pre> - 1 Private ActiveLock As ActiveLock2.IActiveLock + <pre> 1 Private ActiveLock As ActiveLock2.IActiveLock </pre> </blockquote> <li>Also declare a reference to ActiveLock2.ActiveLockEventNotifier so that you can receive COM events sent by ActiveLock 2. <blockquote> - <pre> - 2 Private WithEvents ActiveLockEventSink As ActiveLockEventNotifier + <pre> 2 Private WithEvents ActiveLockEventSink As ActiveLock2.ActiveLockEventNotifier </pre> </blockquote> @@ -149,8 +148,7 @@ and add these ActiveLock initialization code: <blockquote> <code> - <pre> - 3 ' Obtain an instance of ActiveLock object + <pre> 3 ' Obtain an instance of ActiveLock object 4 Set ActiveLock = ActiveLock2.NewInstance() 5 6 ' Specify where the license file is @@ -173,6 +171,14 @@ 23 ' Specify Lock Type as Lock-to-HardDrive. ' The System drive (where Windows is installed) will be used as part of the lock key. 24 ActiveLock.LockType = lockHD + +And with these differences in VB.Net: + + 4 Activelock = ALGlobals.NewInstance() + + 7 Activelock.KeyStoreType = ActiveLock2.LicStoreType.alsFile + +24 Activelock.LockType = ActiveLock2.ALLockTypes.lockHD </pre> </code> </blockquote> @@ -187,8 +193,7 @@ <p>OK. So now you've got ActiveLock successfully initialized. At some point in your application's lifetime, it will need to check for a valid license. This is accomplished by calling IActiveLock's <code>Acquire()</code> method. <code> - <pre> - 25 ' Attempt to acquire a valid license token + <pre> 25 ' Attempt to acquire a valid license token 26 On Error GoTo ErrHandler 27 ActiveLock.Acquire ' Acquire will raise an error if no valid license exists. 28 Exit Sub ' Exit Form_Load() @@ -202,7 +207,7 @@ <code>RegisteredUser</code>, <code>UsedDays</code>, <code>ExpirationDate</code>, etc... For further information on these properties, refer to the IActiveLock interface in the API Documentation. <p>OK. Based on what you've done so far, if you now try to run your application, you should get this error message: - <p><img src="images/nolic.jpg"> + <p><img src="images/nolic.jpg" width="186" height="100"> </blockquote> <a name="step5"><h2>Step 5: License Registration</h2></a> @@ -213,8 +218,7 @@ the installation code. Let's also add a text box for specifying the registered user. This way, the registered user will now be part of the Installation Code, which means that the liberation will not specific to the machine, but it's also specific to a particular user. The code that re-computes the installation code might look like this: - <pre> - 32 ' Re-compute Installation Code when "Registered User" changes + <pre> 32 ' Re-compute Installation Code when "Registered User" changes 33 Private Sub txtUser_Change() 34 txtInstCode = ActiveLock.InstallCode(txtUser) 35 End Sub @@ -236,7 +240,7 @@ <li>Click the <b>Generate</b> button </ol> <p>Congratulations! You've generated your first ActiveLock 2 liberation key. <br> - <img src="images/keygen.jpg"> + <img src="images/keygen.jpg" width="590" height="404"> <p>Now back in your application, you'll need to provide a way for the user to input the liberation key for activation. Again for simplicity's sake, I'll fall back to my favourite TextBox and Command Button combination: <ol> @@ -244,8 +248,7 @@ <li>Add a multi-line Text Box and name it <b>txtLibKey</b> <li>Add a command button and name it <b>cmdReg</b> <li>Add the following code snippet to the cndReg Click event handler: - <pre> -' Register the liberation key + <pre>' Register the liberation key 36 Private Sub cmdReg_Click() 37 ' Be prepared to handle registration error (e.g. invalid license) 38 On Error GoTo ErrHandler @@ -258,7 +261,7 @@ 45 End Sub </pre> </ol> - <img src="images/keyreg.jpg"> + <img src="images/keyreg.jpg" width="588" height="274"> </blockquote> <a name="step6"><h2>Step 6: Let's Get A Little More Advanced</h2></a> @@ -274,9 +277,7 @@ <table CELLPADDING="0" CELLSPACING="0" border="1"> <tr> <td> - <pre> - -[MyApp] + <pre>[MyApp] ProductKey=AAAAB3NzaC1yc2EAAAABJQAAAIB9JNUb5AAI7xnlCRB2muU0PO/Q5jY/hVz1y..... ProductVersion=1.0 LicenseType=3 @@ -303,8 +304,7 @@ your encrypted value, and computes an MD5 hash for it, then saves it as the <code>hash1</code> value. <p>Here's an example of a simple encryption implementation: - <pre> -'' + <pre>'' ' Simple encryption of a string: simply multiply every character's ASCII code by 11. ' 46 Private Function Enc(strData As String) As String @@ -324,8 +324,7 @@ 60 End Function </pre> <p>Then, you handle <code>ActiveLockEventNotifier_ValidateValue()</code> event like this: -<pre> -61 Private Sub ActiveLockEventSink_ValidateValue(ByRef Value As String) +<pre>61 Private Sub ActiveLockEventSink_ValidateValue(ByRef Value As String) 62 Value = Encrypt(Value) 63 End Sub </pre> @@ -371,6 +370,13 @@ </dl> </blockquote> +<a name="revhistory"><h2>Revision History</h2></a> +<blockquote> + <pre> +11.26.03 - Dan Keeley - Added instructions for VB.Net + - Some other minor corrections. + </pre> +</blockquote> <hr> <small> ActiveLock<sup><font size=-2>TM</font></sup> is a trademark of Nelson Ferraz <br> |