Category : C++ Source Code
Archive   : AFXVBX.ZIP
Filename : README.TXT

 
Output of file : README.TXT contained in archive : AFXVBX.ZIP
This sample application shows you how to display a vbx control in a
dialog box that is a resource of an AFXDLL. The dialog template contains
a list of the controls for the dialog box. One of the items in this list
is the class name for the control. Since VBX controls are not standard
Windows controls they do not have a class name. MFC works around this by
providing a Windows class, VBControl, which it can use to create VBX
controls. The VBControl class is used as the class name in the dialog
template for every VBX control used in the dialog.

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.

Workarounds:

[1] 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).

[2] Re-register the VBControl class in the DLL so that it can be used from
the DLL. Also, change the resorce instance handle during the
OnInitDialog() function so that resource in the DLL will be used while
the controls are being created.

This second method is demontrated in the sample.




  3 Responses to “Category : C++ Source Code
Archive   : AFXVBX.ZIP
Filename : README.TXT

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/