Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

BUG: Cannot Use RES Protocol to Display Licensed Controls


View products that this article applies to.

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.

↑ Back to the top


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.

↑ Back to the top


Resolution

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

↑ Back to the top


Status

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

↑ Back to the top


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

  1. Create a Visual Basic licensed ActiveX control. To mark it as licensed, on the Project menu, click <MyProject> Properties, and click Enable licensing. Make sure that you give this project a unique name.
  2. On the General tab, select the Require License Key check box.
  3. Build the ActiveX control OCX file, and name the file MyVbCtrl.ocx.
  4. 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).
  5. In Visual C++, create a simple Win32 dynamic-link library (DLL) project, and insert an .rc file. These steps refer to this project as "Mydll" and refer to the DLL that it generates as "Mydll.dll".
  6. On the Resource tab, insert a new HTML resource. By default, the first ID for the HTML resource is IDR_HTML1.
  7. On the View menu, click Resource Symbols to get the value of the first ID (which is usually 101).
  8. 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 = "clsid:5220cb21-c88d-11cf-b347-00aa00a28331" VIEWASTEXT>
       <PARAM NAME="LPKPath" VALUE="MYVBCTRL.LPK">
    </OBJECT>
    </HEAD>
    
    <BODY>
    <OBJECT WIDTH=200 HEIGHT=200
     CLASSID="CLSID:281A970F-4B42-4089-AD06-BAEF06D547AA">
    </OBJECT>
    </BODY>
    </HTML>
    					
  9. 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.
  10. 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.
  11. Import the .lpk file into your .rc file in the DLL project as a custom resource. Name the custom resource type as "LPK" (with double quotes) and the new resource name as "MYVBCTRL.LPK" (with double quotes) as follows:
    1. In the Resource View of the DLL project, right-click the project's top level resource node, and then click Import.
    2. In the Open File dialog box, click MyVbCtrl.lpk, and type "LPK" with double quotes for the resource type.
    3. Right-click the new resource (under the "LPK" node), and rename it to "MYVBCTRL.LPK" with double quotes.
  12. Build the DLL project. Get the full path name of the DLL (for example, C:\Test\Mydll.dll).
  13. 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.
  14. 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).
  15. At a command prompt, type the following command to register the .ocx file:
    regsvr32 myvbctrl.ocx
  16. 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.
  17. If you double-click the Html1.htm file, the control appears as expected.

↑ Back to the top


References

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
237769 FIX: RES Protocol with Custom Resource Only Works on Windows NT
For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:

↑ Back to the top


Properties

Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

↑ Back to the top


Keywords: kbbug, kbctrlcreate, kblicensing, kbpending, KB272762

↑ Back to the top

Article Info
Article ID : 272762
Revision : 4
Created on : 7/24/2007
Published on : 7/24/2007
Exists online : False
Views : 468