# WinNativeCommonCtls Package
{: .no_toc }

The **WinNativeCommonCtls** built-in package is a VB6-compatible replacement for **Microsoft Common Controls 6.0** (the legacy `MSCOMCTL.OCX`), reimplemented on top of the Win32 ComCtl32 controls in `COMCTL32.DLL` and `MSFTEDIT.DLL`. It ships eight controls that mirror the MSCOMCTL member names where possible, with the same property / method / event spellings VB6 developers will recognise.

![A form holding seven of the package's controls: a TreeView of folders, a ListView in report view, a MonthView with four days selected and two in bold, a DTPicker, an UpDown beside a text box, a Slider and a ProgressBar](/Reference/Built-In/WinNativeCommonCtls/Images/Overview.png){:width="541" height="432"}

The package is a built-in package shipped with twinBASIC. Add it through Project → References... (**Ctrl-T**) → the **Available Packages** tab.

* TOC
{:toc}

## Why this package exists

VB6 projects that depend on `MSCOMCTL.OCX` cannot run unmodified in modern environments --- the OCX is unsigned, requires per-machine registration with admin rights, ships with known security advisories, and is not available on non-Windows hosts at all. **WinNativeCommonCtls** removes the dependency: drop a [**ListView**](/tB/Packages/WinNativeCommonCtls/ListView/index.md), [**TreeView**](/tB/Packages/WinNativeCommonCtls/TreeView/index.md), [**ProgressBar**](/tB/Packages/WinNativeCommonCtls/ProgressBar.md), [**Slider**](/tB/Packages/WinNativeCommonCtls/Slider.md), [**ImageList**](/tB/Packages/WinNativeCommonCtls/ImageList/index.md), [**DTPicker**](/tB/Packages/WinNativeCommonCtls/DTPicker.md), [**MonthView**](/tB/Packages/WinNativeCommonCtls/MonthView.md), or [**UpDown**](/tB/Packages/WinNativeCommonCtls/UpDown.md) onto a [**Form**](/tB/Packages/VB/Form/index.md) and twinBASIC creates the underlying Win32 ComCtl32 control directly, with no OCX involved.

The control names, property names, event signatures, and the `vb…` / `tvw…` / `lvw…` / `sld…` / `Prb…` member-name conventions all match the original `MSCOMCTL.OCX` API, so VB6 code that uses the original controls usually compiles and runs unchanged once the package reference is in place.

## Controls

Eight controls, each a leaf class that inherits from a `<Name>BaseCtl` where the entire API is declared:

- [DTPicker](/tB/Packages/WinNativeCommonCtls/DTPicker.md) -- date / time picker: dropdown calendar, single-date [**Value**](/tB/Packages/WinNativeCommonCtls/DTPicker.md#value), custom format strings, optional spin-button and checkbox variants
- [ImageList](/tB/Packages/WinNativeCommonCtls/ImageList/index.md) -- off-screen image collection that feeds icons to [**ListView**](/tB/Packages/WinNativeCommonCtls/ListView/index.md) and [**TreeView**](/tB/Packages/WinNativeCommonCtls/TreeView/index.md) through the [**Icons**](/tB/Packages/WinNativeCommonCtls/ListView/index.md#icons) / [**SmallIcons**](/tB/Packages/WinNativeCommonCtls/ListView/index.md#smallicons) / [**ImageList**](/tB/Packages/WinNativeCommonCtls/TreeView/index.md#imagelist) properties; not visible at run time
- [ListView](/tB/Packages/WinNativeCommonCtls/ListView/index.md) -- multi-column list with four [**View**](/tB/Packages/WinNativeCommonCtls/ListView/index.md#view) modes (Icon / SmallIcon / List / Report), label-edit, checkboxes, column-header icons, and per-item state
- [MonthView](/tB/Packages/WinNativeCommonCtls/MonthView.md) -- full-month calendar grid with multi-month layout ([**MonthColumns**](/tB/Packages/WinNativeCommonCtls/MonthView.md#monthcolumns) × [**MonthRows**](/tB/Packages/WinNativeCommonCtls/MonthView.md#monthrows)), multi-day selection, bold-day callbacks for highlighting, week numbers, and a today indicator
- [ProgressBar](/tB/Packages/WinNativeCommonCtls/ProgressBar.md) -- standard / smooth / marquee progress indicator with three visual states (Normal / Error / Paused), horizontal or vertical orientation
- [Slider](/tB/Packages/WinNativeCommonCtls/Slider.md) -- trackbar / slider with tick marks, optional selection range, vertical or horizontal orientation, and a draggable thumb with floating tip
- [TreeView](/tB/Packages/WinNativeCommonCtls/TreeView/index.md) -- hierarchical tree of [**Node**](/tB/Packages/WinNativeCommonCtls/TreeView/Node.md) objects with sorting, label-edit, checkboxes, image lists, and per-node bold / color overrides
- [UpDown](/tB/Packages/WinNativeCommonCtls/UpDown.md) -- spin control with up / down arrows: pure [**Min**](/tB/Packages/WinNativeCommonCtls/UpDown.md#min) / [**Max**](/tB/Packages/WinNativeCommonCtls/UpDown.md#max) / [**Value**](/tB/Packages/WinNativeCommonCtls/UpDown.md#value) / [**Increment**](/tB/Packages/WinNativeCommonCtls/UpDown.md#increment) (no auto-buddy)

[**ListView**](/tB/Packages/WinNativeCommonCtls/ListView/index.md), [**TreeView**](/tB/Packages/WinNativeCommonCtls/TreeView/index.md), and [**ImageList**](/tB/Packages/WinNativeCommonCtls/ImageList/index.md) include collection sub-objects --- see the folder index pages for the full hierarchy.

## Enumerations

Module-level enumerations shared across multiple controls live under [**Enumerations**](/tB/Packages/WinNativeCommonCtls/Enumerations/index.md); per-control nested enumerations (`ListViewConstants`, `PrbState`, `TickStyleConstants`, …) are documented on the page of the control that declares them.

- [Enumerations](/tB/Packages/WinNativeCommonCtls/Enumerations/index.md) -- the ten user-facing enumerations declared in shared modules

## Cross-control members

Every control inherits the standard VB-package members from `BaseControl` / `BaseControlRect` / `BaseControlRectDockable` / `BaseControlFocusable` (or `BaseControlNotFocusable`, where the control cannot take focus). Inherited members include:

- **Positioning and layout** --- **Name**, **Left**, **Top**, **Width**, **Height**, **Anchors**, **Dock**, **Visible**, **Enabled**, **Move**, **Refresh**, **ZOrder**, **Container**, **Parent**, **Index**, **Tag**, **hWnd**
- **Appearance** --- **BackColor** / **ForeColor** / **Font** (where focusable), **Appearance**, **VisualStyles**, **MousePointer** / **MouseIcon**
- **Tooltips, drag-and-drop, validation** --- **ToolTipText**, **DragMode** / **DragIcon**, **Drag**, **CausesValidation**, **Validate** event
- **Focus** (focusable controls only) --- **SetFocus**, **TabIndex**, **TabStop**, **GotFocus** / **LostFocus** events
- **Help integration** --- **HelpContextID**, **WhatsThisHelpID**
- **OLE drag-and-drop** --- **OLEDropMode**, the **OLEDrag** method, and the **OLEStartDrag** / **OLEGiveFeedback** / **OLESetData** / **OLEDragOver** / **OLEDragDrop** / **OLECompleteDrag** events. See [**OLEDropConstants**](/tB/Packages/VBRUN/Constants/OLEDropConstants.md)
- **Transparency** --- **Opacity** (`Double`, 0--100, percentage) and **TransparencyKey** (`OLE_COLOR`, `-1` to disable). Both require Windows 8 (target OS 6.2+) for child controls; on older OS versions they are silently no-ops

Each control's reference page lists the control-specific members --- own properties, methods, events, and nested enums --- without re-enumerating the entire inherited base every time.

## Control type constants

Every control answers to one of the `vb…` values in [**ControlTypeConstants**](/tB/Packages/VBRUN/Constants/ControlTypeConstants.md):

| Constant            | Value | Control                            |
|---------------------|-------|------------------------------------|
| **vbProgressBar**   | 21    | [ProgressBar](/tB/Packages/WinNativeCommonCtls/ProgressBar.md)         |
| **vbTreeView**      | 22    | [TreeView](/tB/Packages/WinNativeCommonCtls/TreeView/index.md)              |
| **vbSlider**        | 26    | [Slider](/tB/Packages/WinNativeCommonCtls/Slider.md)                   |
| **vbUpDown**        | 27    | [UpDown](/tB/Packages/WinNativeCommonCtls/UpDown.md)                   |
| **vbDTPicker**      | 28    | [DTPicker](/tB/Packages/WinNativeCommonCtls/DTPicker.md)               |
| **vbMonthView**     | 29    | [MonthView](/tB/Packages/WinNativeCommonCtls/MonthView.md)             |
| **vbListView**      | 30    | [ListView](/tB/Packages/WinNativeCommonCtls/ListView/index.md)              |
| **vbImageList**     | 31    | [ImageList](/tB/Packages/WinNativeCommonCtls/ImageList/index.md)            |

Each control's **ControlType** property returns its constant at run time, allowing generic `For Each` loops over a form's **Controls** collection to discriminate between controls.

## See also

- [VB Package](/tB/Packages/VB/index.md) -- the standard control set: **CheckBox**, **CommandButton**, **TextBox**, **Frame**, **Form**, …
- [CustomControls Package](/tB/Packages/CustomControls/index.md) -- owner-drawn `Waynes…` custom controls when the Win32 API is not enough
- [ControlTypeConstants](/tB/Packages/VBRUN/Constants/ControlTypeConstants.md) -- the `vb…` discriminator constants used by the **ControlType** property on every control
- [OLEDropConstants](/tB/Packages/VBRUN/Constants/OLEDropConstants.md) -- the **OLEDropMode** values shared by every control in this package
