View Menu

Chapter 26 - Getting Started with ActiveX Controls

Visual C++ 6: The Complete Reference
Chris H. Pappas and William H. Murray, III
  Copyright 1998 The McGraw-Hill Companies

Chapter 26: Getting Started with ActiveX Controls
Overview
You are already familiar with a wide variety of Windows controls such as radio buttons, checkboxes, list boxes, and so on. Many developers also design their own controls. This special group of controls is known as ActiveX or custom controls. As Windows evolved from 3.x to Windows 95, 98, and NT, so have custom controls. Custom controls really had their beginning with Microsoft’s Visual Basic programming language. Visual Basic made it easy to implement new controls that were not part of the standard group of Windows controls. These custom controls, originally known as VBXs (after their original file extension .VBX), were specialty items. They were actually small dynamic link libraries (DLL) with .VBX file extensions. Custom controls have now evolved into 32-bit controls with new abilities. These new controls use an .OCX file extension. A good example of a custom control is a custom slide bar that might be used to control the volume in a CD-ROM player application.
There is a commercial market for well designed custom controls. However, custom controls developed commercially can also be much more complicated. Some include complete spreadsheet, image, and database capabilities within the control!
Many programmers have developed custom controls using Visual Basic and then incorporated them into their C/C++ applications. Obviously, the C/C++ language has needed its own mechanism for creating custom controls. At the same time Microsoft was developing a solution, they began the migration from 16-bit Windows 3.1 to 32-bit Windows 95 and NT. As it turns out, the hardware-specific 16-bit VBX controls will not serve the new 32-bit multiple platform environments as well as programmers desired. Thus, Microsoft decided that rather than expand the VBX specifications, it would redesign the custom control architecture to include the 32-bit platforms; thus, the new control specifications with .OCX file extensions. Under Windows 95, 98, and Windows NT, OCX controls are the natural replacement for the older VBX custom controls of Visual Basic. These new custom controls will also serve container applications such as Microsoft Access, Excel, Word, PowerPoint, and so on. The term “custom control” has largely been replaced with “ActiveX control.”
The good news concerning controls for the C++ developer is that ActiveX controls have a built-in Microsoft C++ wizard that helps build the control. This wizard is officially called the MFC ActiveX ControlWizard. The wizard builds the ActiveX control using object-oriented C++ code and takes full advantage of the MFC.
During development, your controls can be tested with the ActiveX Test Container tool. Once the ActiveX control is complete, it can be incorporated into any application that supports OLE objects. Microsoft Word, Excel, and Access are typical applications that support ActiveX controls.
  Note There is another aspect to Windows controls—controls that involve the COM object-model. This group of controls allows control usage independent of the container and thus is ideal for languages such as Visual Basic, Visual C++, and even dynamic HTML.

Books24x7.com, Inc 2000 –  


Visual C++ 6(c) The Complete Reference
Visual Studio 6: The Complete Reference
ISBN: B00007FYGA
EAN: N/A
Year: 1998
Pages: 207

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net