Microsoft KB Archive/272762

= BUG: Cannot Use RES Protocol to Display Licensed Controls =

Article ID: 272762

Article Last Modified on 7/24/2007

-

APPLIES TO


 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 4.01 Service Pack 1
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 5.01
 * Microsoft Internet Explorer (Programming) 5.01 SP1
 * Microsoft Internet Explorer 5.5

-



This article was previously published under Q272762



SYMPTOMS
When you use the RES protocol to display an HTML page, if the HTML page contains a licensed control, you cannot view the control as licensed.



CAUSE
This problem occurs because the license manager, which reads the .lpk file and supplies the license key, cannot use the RES protocol to access the .lpk file.



RESOLUTION
To resolve this problem, do not use licensed controls in an HTML page that is displayed using the RES protocol.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
The license manager reads the license information from the .lpk file and provides this information to Internet Explorer so that Internet Explorer can create the licensed controls on the HTML page. To read the .lpk file, the license manager calls the UrlDownloadToCacheFile function. However, this call fails with 0x80004005 (Unspecified Error) when the license manager receives a RES protocol URL. Because the license manager cannot accept absolute URLs for the license file, you cannot use another domain or protocol to point the license manager to an .lpk file. The only alternative is not to use licensed controls.

Steps to Reproduce Behavior
 Create a Visual Basic licensed ActiveX control. To mark it as licensed, on the Project menu, click  Properties, and click Enable licensing. Make sure that you give this project a unique name. On the General tab, select the Require License Key check box. Build the ActiveX control OCX file, and name the file MyVbCtrl.ocx. Debug the project and copy the CLSID information from the source code of the HTML page that Internet Explorer displays (for example, 281A970F-4B42-4089-AD06-BAEF06D547AA). In Visual C++, create a simple Win32 dynamic-link library (DLL) project, and insert an .rc file. These steps refer to this project as &quot;Mydll&quot; and refer to the DLL that it generates as &quot;Mydll.dll&quot;.</li> On the Resource tab, insert a new HTML resource. By default, the first ID for the HTML resource is IDR_HTML1.</li> On the View menu, click Resource Symbols to get the value of the first ID (which is usually 101).</li>  Double-click the IDR_HTML1 icon, and insert the following HTML code, which displays the control and contains a reference to an .lpk file: <HTML> <HEAD> <OBJECT CLASSID = &quot;clsid:5220cb21-c88d-11cf-b347-00aa00a28331&quot; VIEWASTEXT> <PARAM NAME=&quot;LPKPath&quot; VALUE=&quot;MYVBCTRL.LPK&quot;> </OBJECT> </HEAD>

<BODY> <OBJECT WIDTH=200 HEIGHT=200 CLASSID=&quot;CLSID:281A970F-4B42-4089-AD06-BAEF06D547AA&quot;> </OBJECT> </BODY> </HTML> </li> The HTML resource should have a corresponding external file named Html1.htm. You can right-click the IDR_HTML1 node, and then click Properties to view this information.</li> Run the LPKTool.exe file (in the Microsoft Knowledge Base article 159923) to insert the license information for your Visual Basic control. Save the .lpk file as MyVbCtrl.lpk.</li> Import the .lpk file into your .rc file in the DLL project as a custom resource. Name the custom resource type as &quot;LPK&quot; (with double quotes) and the new resource name as &quot;MYVBCTRL.LPK&quot; (with double quotes) as follows: <ol style="list-style-type: lower-alpha;"> In the Resource View of the DLL project, right-click the project's top level resource node, and then click Import.</li> In the Open File dialog box, click MyVbCtrl.lpk, and type &quot;LPK&quot; with double quotes for the resource type.</li> Right-click the new resource (under the &quot;LPK&quot; node), and rename it to &quot;MYVBCTRL.LPK&quot; with double quotes.</li></ol> </li> Build the DLL project. Get the full path name of the DLL (for example, C:\Test\Mydll.dll).</li> Start Internet Explorer, and use the RES protocol to display the page (for example, res://C:\Test\Mydll/101). The control should appear without any problems.</li> Copy Mydll.dll, MyVbCtrl.ocx, Html1.htm, and MyVbCtrl.lpk onto another computer that has Visual Basic installed (or you can also copy the Visual Basic run-time DLLs if Visual Basic is not installed). Make sure that all of the files are copied into the same folder (for example, C:\Test).</li> At a command prompt, type the following command to register the .ocx file:

regsvr32 myvbctrl.ocx

</li> Start Internet Explorer, and use the RES protocol to display the page (for example, res://C:\Test\Mydll/101). The control does not display correctly.</li> If you double-click the Html1.htm file, the control appears as expected.</li></ol>

<div class="references_section">