SAMPLE: MFCVBX Implements a VBX Control Using MFC

Last reviewed: July 18, 1997
Article ID: Q123377
1.00 1.50 WINDOWS kbprg kbfile kbinterop kbcode

The information in this article applies to:

  • The Microsoft Foundation Classes (MFC) included with Microsoft Visual C++ for Windows, versions 1.0 and 1.5

SUMMARY

NOTE: You need VBX Control Development Kit to create a VBX control. The VBX Control Development Kit comes with the Professional Edition of Visual Basic and with the Visual Control Pack. But it does not come with Visual C++.

The MFCVBX sample demonstrates how to write a VBX control using MFC.

Download MFCVBX.EXE, a self-extracting file, from the Microsoft Software Library (MSL) on the following services:

  • Microsoft Download Service (MSDL)

          Dial (206) 936-6735 to connect to MSDL
          Download MFCVBX.EXE (size: 23218 bytes) 
    
  • Internet (anonymous FTP)

          ftp ftp.microsoft.com
          Change to the SOFTLIB\MSLFILES directory
          Get MFCVBX.EXE (size: 23218 bytes) 
    

MORE INFORMATION

The sample implements a VBX control as a _USRDLL. This enables the sample to be used by MFC and Visual Basic applications. Creating a VBX control as an extension DLL (_AFXDLL) would restrict the VBX making it usable only by MFC applications.

It is important that the MODEL, Property, and Event structures be declared NEAR in order for this control to work correctly. It is also important that you create an object of a class derived from CWinApp.

Depressing the right button inside the control when your application is executing will display a message box indicating the point of your mouse click.

You can use AppStudio to set the properties of this control. You can use ClassWizard to manipulate the CVBCtlWnd class if needed.

For more information on _USRDLLs refer to MFC TechNote #11 and the MFC sample DLLTRACE.

The VBAPI.H and VBAPI.LIB Include files are not included with this sample. In order to build the sample, you will need these files, which are included with the VBX Control Development Kit (see the NOTE above).


Additional reference words: kbinf CVBControl CDK 1.00 1.50 2.00 2.50
KBCategory: kbprg kbfile kbinterop kbcode
KBSubcategory: MfcVBX
Keywords : kb16bitonly MfcVBX kbcode kbfile kbinterop kbprg
Technology : kbMfc
Version : 1.00 1.50
Platform : WINDOWS


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: July 18, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.