Microsoft KB Archive/184687

= INFO: Lightweight Controls in Visual Basic 6.0 =

Article ID: 184687

Article Last Modified on 2/17/2005

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q184687



SUMMARY
This article contains information about the lightweight, or windowless, controls that ship with Visual Basic version 6.0. This article also describes lightweight controls, explains their advantages and disadvantages, and illustrates how to install lightweight controls in your Visual Basic project.



MORE INFORMATION
Lightweight controls, sometimes referred to as windowless controls, are similar to the regular controls shipped in Visual Basic except that they do not have a window handle. Because lightweight controls do not have a window handle, these controls use less system resources. Lightweight controls are ideal for projects where system resources might be a limiting factor, such as Internet applications and distributed applications.

Lightweight controls with a Transparent BackStyle property are truly transparent. A regular control might appear to be transparent under the same conditions. However, the control is still processing Windows messages in that transparent background area. When a lightweight control has a transparent background, the container holding the lightweight control actually processes the Windows messages instead of the lightweight control. Because lightweight controls are truly transparent, these controls can be any shape.

There are some disadvantages to lightweight controls. Lightweight control containers can only contain other lightweight controls. If you put a regular control in a lightweight control container, the container will revert to a regular window control container. Regular controls always appear on top of a lightweight control because the lightweight control uses the resources of the parent window.

When you run Visual Basic, the following controls in your Toolbox are lightweight controls:
 * Image Control
 * Label Control
 * Line Control
 * Shape Control

In addition to these intrinsic lightweight controls, following are other lightweight controls included in the component file MSWLess.ocx that ships with Visual Basic 6.0:
 * WLCheck Control
 * WLCombo Control
 * WLCommand Control
 * WLFrame Control
 * WLHScroll Control
 * WLVScroll Control
 * WLList Control
 * WLOption Control
 * WLText Control

To use these controls in your Visual Basic program, you must complete the following steps:
 * 1) Register the windowless component file in your system registry.
 * 2) Copy the component file and help files to the appropriate directories in your system.
 * 3) Add the ActiveX controls to your Visual Basic program.

How To Register the Windowless Component File
 Search for the registration file, MSWLess.reg, on your Visual Basic installation disks. The file is located in the Common\Tools\Vb\WinLess directory on disk 1. NOTE: The windowless controls are in the following location on the August 1998 MSDN CDs: Disk3\Common\Tools\VB\Winless. Double-click MSWLess.reg. The following Registry Editor dialog box appears when you have successfully registered the windowless component file:

Information in the Common\Tools\Vb\WinLess\MSWLess.reg has been successfully entered into the registry.

You have just registered the windowless component file. The next section shows you how to copy the appropriate windowless component and Help files to your computer.

How To Copy the Windowless Component Files
  Search for the following files on your Visual Basic installation disks. These files are located in the Common\Tools\Vb\WinLess directory on disk 1.   Filename           Description ltwtct98.chi      Help file on windowless controls. ltwtct98.chm      Help file on windowless controls. MSWLess.ocx       Windowless component file with the windowless ActiveX Controls.  Copy the two Help files to your local Windows\Help directory. Copy the windowless component file, MSWLess.ocx, to your local Windows\System directory. You have just copied all the necessary windowless component files. The next section shows you how to add a windowless control to your Visual Basic program.</li></ol>

How To Add a Windowless Control To Your Project

 * 1) Start a new project in Visual Basic.
 * 2) From the Project menu, click Components. The Components dialog box appears.
 * 3) From the Controls tab, select the Microsoft Windowless Controls 6.0 check box.
 * 4) Click OK to close the Components dialog box. All the windowless controls appear on the toolbar.

<div class="references_section">