BUG: Cannot Use RES Protocol to Display Licensed Controls

Article translations Article translations
Article ID: 272762 - View products that this article applies to.
This article was previously published under Q272762
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page


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.


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.


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


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


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:
    <OBJECT CLASSID = "clsid:5220cb21-c88d-11cf-b347-00aa00a28331" VIEWASTEXT>
  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.


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:



Article ID: 272762 - Last Review: October 21, 2013 - Revision: 3.1
  • 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
kbnosurvey kbarchive kbbug kbctrlcreate kblicensing kbpending KB272762

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com