Library sample chapters
ActiveX controls
Digital Signatures
It's obvious that marking a control to be safe isn't enough for most users. After all, anyone can mark a control as safe. Even if they trust your good intentions and your ability as a programmer, they can't be absolutely sure that the control is actually coming from you or that it hasn't been tampered with after you compiled it.
Microsoft has solved this problem by making it possible for you to add a digital signature to ActiveX controls by using a public key encryption algorithm. To digitally sign a control, you need a private encoding key, which you obtain from a company that issues digital certificates-for example, VeriSign Inc. You must pay a fee to obtain such certificates, but they are quite affordable even for individual developers. For more information, pay a visit to http://www.verisign.com. Once you have obtained a certificate, you can sign your control-or, most likely, its CAB file-using the SignCode utility which is included in the ActiveX SDK. You can add a digital signature to EXE, DLL, and OCX files, but you need to do so only if you plan to distribute them without packaging them in a CAB file.
Licensing
ActiveX controls can be sold as part of a business application to users or as stand-alone components to other developers. In the latter case, your customers should be able to use the control at design time and also redistribute it with their own applications. If you don't want their customers to be able to redistribute your control, you need to add a license key to your control.
The Require
License Key option
If you tick the Require License Key option on the General tab of the Project Properties dialog box and then compile the ActiveX control, Visual Basic generates a VBL (Visual Basic License) file that contains the license for the control. For example, this is the VBL file generated for the ClockOCX control:
REGEDIT HKEY_CLASSES_ROOT\Licenses = Licensing: Copying the keys may be a violation of established copyrights. HKEY_CLASSES_ROOT\Licenses\27E428DE-9145-11D2-BAC5-0080C8F21830 = geierljeeeslqlkerffefeiemfmfglelketf
As you see, a VBL file is nothing but a script for the Registry. When you create a standard installation procedure, the Wizard includes this file in the package. When other developers buy your control and install it on their machines, the installation routine uses this file to patch their Registries but won't copy the file on their hard disks. For this reason, when they redistribute your control as part of their applications, the VBL isn't included in the deployment package and their customers won't be able to use the control at design time (unless, of course, they buy a license from you).
A control that requires a license key always looks for this key when it's instantiated. If the control is used in a compiled program, the license key is included in the executable EXE file. But if the control is used in an interpreted environment, no executable file can provide the key and the control has to look for it in the Registry. This means that to use the control on a Visual Basic form or in a Microsoft Office application (or another VBA-powered environment), you need the license to be installed in the Registry.
If your control includes other ActiveX controls as constituent controls, you should license them for distribution as well; otherwise, your control won't correctly work at design time. Of all the controls included in the Visual Basic package, the only one that you can't redistribute is the DBGrid control. Note, however, that the Microsoft License Agreement specifies that you can use Microsoft controls in your ActiveX control only if you significantly expand their functionality. I never found anywhere how that "significantly" can be measured, though.
License keys
for controls on Web pages
The mechanism that I've just described doesn't address the particular nature of ActiveX controls on a Web page. In fact, it doesn't make sense to require that the user machine have the control's license key installed in the Registry. Nor do you want to send the license key with the control in a readable form in the HTML page. The solution to this difficulty comes in the form of a License Package File (or LPK file for short). You create this file by using the Lpk_Tool.Exe utility that you can find in the \Common\Tools\Vb\Lpk_Tool subdirectory. (See Figure 17-21.) Once you have created an LPK file, you reference it with a parameter to the <PARAM> tag, as follows:
|
<PARAM NAME="LPKPath" VALUE="ClockOCX.lpk"> |
This parameter tells the browser where it can download the license key of the ActiveX control; the license key is transferred each time the page is downloaded because the license keys of ActiveX controls found on HTML pages are never added to the client machine's Registry. The value of the LPKPath parameter can be a relative or an absolute URL, but in the latter case you might have problems when moving the HTM file to another location of your site. The owner of the Web site must have purchased a license for your ActiveX control to be able to send it in HTML pages. In other words, as far as the license mechanism is concerned, Web site owners are regarded as developers.
Figure 17-21.
The Lpt_Tool utility can create an LPK file containing the
license keys of one or more ActiveX controls.
|
It should be made clear that the license mechanism provided by Visual Basic isn't bulletproof. After all, a malicious developer has only to copy the VBL from the installation diskette or-if that file is no longer available-retrieve the relevant information from the Registry and re-create the VBL file. Actually, the only thing you can be sure of is that the license key won't be accidentally included in an installation procedure. If you need a more secure system, you should devise an alternative method based on alternate locations of the Registry or custom license files loaded in system directories. |
If you have carefully read Chapter 16 and this chapter, you might be surprised to see how few features Visual Basic 6 has added to those already available in Visual Basic 5. But you see the real potential of components and controls when you add ADO to the equation and begin to build data-aware classes and components. These new capabilities are described in the next chapter.
Related articles
Related discussion
-
VB6, SQL 2005 & DMO
by elajaunie3 (1 replies)
-
sending sms from pc
by sriraj20074 (0 replies)
-
Automating Excel from VB6.0
by epurdy (0 replies)
-
VB6 system conversion using VBA to Word 2007
by b.macgregor@vodamail.co.za (0 replies)
-
video not working with visual basic
by Jupiter 2 (9 replies)
I also looking for the control for years, but still can't get a good one, some control only make a form transparent instead of a control like picturebox, some control only copy the picture of background under it, isn't real transparent. some controls have transparent background but the transparent area is a hole that you can click controls behind it in z-order. I ever tried the following code in a form:
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Global Const GWL_EXSTYLE = (-20)
Global Const WS_EX_TRANSPARENT = &H20&
add a textbox on the form and a picturebox named picturebox1 over it, in form_load event add this code:
SetWindowLong picturebox1.hwnd, GWL_EXSTYLE, WS_EX_TRANSPARENT
the problems are, only when content of textbox change(by code), the picturebox was changed to transparent, second, when then picturebox resized, the picturebox was changed back to white.usually.
dear sir, if you have got a ideal method to make this control, would you please send me a copy? thank a lot.
i want to create a transperent picturebox behind it i will put internet control / webbrowser.
user will able to see the webpage and unable to click on web page ,
and he would not be able to select text / image .
is it possible to create such a activx picture box . i need it urgently . please reply.as soon as possible
In .NET it is possible to show properties to users of comoponents during runtime. Is there a method to show PropertyPages during Runtime of a VB 6.0 ActiveX control?
Thanks
In .NET it is possible to show properties to users of comoponents during runtime. Is there a method to show PropertyPages during Runtime of a VB 6.0 ActiveX control?
Thanks
Does anyone know how can I convert a *.vbp (visual basic project) into an activex control to use it on a Web Page?
Is it possible to digitally sign an already packaged Active X control or does the code have to be signed.
I want to sign MsRdpClient so we can use it on our intranet without changing IE security settings in the GPO.
Thanks
Hi
very thanx from givig imediate reply.
I have a property page for ActiveX control & if i right click on that control in client design view its show popup menu & in that option is property after clicking it shows the property page what ever i made But the same proprprty page I wan tto display at run time . cos i m developing active control like Rational Rose. so that user ca draw the flow digram & at that time (run time) user can be able to change the property at run time its Background , style etc so it is possible to show the property page at run time
Plz comments
Thanx
Regards
Mahesh
Hi
I want to show the property page at run time for a activeX control so that user can change the backgroun color & style of drawing .
any buddy knows how to show ?
plz comment
Thanx
Regards
adadf
Deep and clear. It was just I was looking for. Great! Thank you.
This thread is for discussions of ActiveX controls.