PRB: Can't Create VB ActiveX Control with Embedded Licensed Ctrl

Last reviewed: October 22, 1997
Article ID: Q175325
The information in this article applies to:
  • Microsoft Visual Basic Control Creation and Professional Editions for Windows, version 5.0

SYMPTOMS

If you embed a licensed ActiveX control inside a Visual Basic ActiveX control and then attempt to use it on another machine, the Visual Basic ActiveX control may fail to instantiate.

CAUSE

By default, Visual Basic ActiveX controls do not support embedding licensed controls unless the embedded control supports a particular GUID.

RESOLUTION

Control vendors do not want other programmers to wrap their controls and distribute them as their own. You may still use licensed controls in other types of projects like ActiveX Documents or Standard EXEs.

STATUS

This behavior is by design.

MORE INFORMATION

When you use a licensed control in a non-ActiveX Control project, Visual Basic caches the license key as part of the project. When you run the program in a machine that doesn't have a design-time license, Visual Basic will use the stored license key to instantiate the licensed control.

Licensed controls that come with Visual Basic that cannot be used inside a UserControl include Crystal(crystl32.ocx), DBGrid(dbgrid32.ocx) and MSChart(mschart.ocx).

The common controls in COMCTL32.OCX are licensed but were written so you can use them in a Visual Basic ActiveX control. For a licensed control to support being instantiated in a Visual Basic control, it needs to support a particular GUID:

   {0x6e6e9780, 0x165d, 0x11d0, {0xb3, 0xe6, 0x00, 0xa0, 0xc9, 0x0f, 0x27,
   0x31}}

Visual Basic will call QueryInterface() on the embedded licensed control's IClassFactory for the above GUID. If the embedded control's IClassFactory returns S_OK and a pointer to the IUnknown interface, Visual Basic will create the licensed control using the cached license key.
Keywords          : vb5all
Version           : WINDOWS:5.0
Platform          : WINDOWS
Issue type        : kbprb


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 22, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.