INFO: Using a VBX Control in an AFXDLL Dialog Box

ID: Q98586

The information in this article applies to:

SUMMARY

An AFXDLL dynamic-link library cannot include a VBX control in one of its dialog box templates (such as those created by AppStudio).

When the application that calls the DLL calls the EnableVBX() function, it registers the VBControl window class with Microsoft Windows. The VBControl class is registered as a local window class, not as a global window class. A local window class is available only to the module in which the class is registered.

Because a DLL has its own module that is different from the calling application, the VBControl class is not available to the DLL.

To work around this behavior, the application can call the Create() member function of the CVBControl class to create the VBX control. Call Create() in the OnInitDialog() function (for a modal dialog box) or in the OnCreate() function (for a modeless dialog box).

Keywords          : kbprg kb16bitonly kbMFC kbVBX kbVC 
Version           : 1.0 1.5

Last Reviewed: July 24, 1997