CommonControls (Replacement of the MS common controls)
This project is intended to replace the MS common controls for VB6.
The "MSCOMCTL.OCX" (respectively "COMCTL32.OCX") can be replaced completly.
The "MSCOMCT2.OCX" (respectively "COMCT232.OCX") can be replaced completly.
The "RICHTX32.OCX" can be replaced completly.
The "COMDLG32.OCX" can be replaced completly.
The "COMCT332.OCX" can be replaced completly.
The "MCIWNDX.OCX" (shipped with VB5) can be replaced completly.
The "SYSINFO.OCX" can be replaced completly.
Unicode is supported for all the stated controls. Also these are full DPI-Aware and ready for 64-bit.
At design-time (IDE) there is only one dependency. (OLEGuids.tlb)
This is a modified version of the original .tlb from the vbaccelerator website.
But for the compiled .exe there are no dependencies, because the .tlb gets then compiled into the executable.
Everything should be self explained, because all functions and properties have a description.
The source code of the project can also be viewed on GitHub.
This Demo shows of how to make the ToolBar control accessible per shortcut key on a MDIForm.
This Demo shows of how to use the ImageCombo control as a DriveCombo. (Replacement of the DriveListBox control)
This VBBubbleW Module shows of how to apply unicode and multi-line text into an intrinsic .ToolTipText property.
ActiveX Control version, together with a Registration-Free (Side-by-side) solution: Version 1.8
Notes:
- When using the SetParent or MoveWindow API, pass .hWndUserControl and not .hWnd.
- When changing the "Project Name", have all forms open, else all properties are lost. Because the library to which the controls are referring to is the "Project Name" itself. Having all forms open will ensure that the .frx files will be updated with the new "Project Name".
List of revisions:
Code:
01-Jun-2026
- Included style WS_CLIPCHILDREN to the Pager control to avoid flicker.
- Bugfix in the BackColor property in the Pager control.
30-May-2026
- Class_Terminate edge case fix for ShowFind/ShowReplace dialogs on MDI child forms in the CommonDialog class.
25-May-2026
- Some minor internal improvements.
- Use of flag DCX_KEEPCLIPRGN in the WM_NCPAINT handler to solve a leak.
This way the system region (wParam) will not be deleted by GetDCEx().
14-May-2026
- AllowImageHighlight property changed to an enum in the ImageCombo control. (defaults to 0 - Always)
12-May-2026
- Included the AllowImageHighlight property in the ImageCombo control. (defaults to True)
When set to False a focused item image is not allowed anymore to be drawn highlighted.
- The Item in the ItemDraw event can now be -1 in the ListBoxW and VListBox control.
11-May-2026
- The FrameW control will now react upon WM_THEMECHANGED.
Before the new theme was not changed at all. (e.g. "DarkMode_DarkTheme")
- The Item in the ItemDraw event can now be -1 in the ComboBoxW and VirtualCombo control.
This allows to draw a background and focus rect when the list index is -1.
Caution! You might need to adapt your ItemDraw handler as this change could cause crashes otherwise.
- FontCombo control (in-built owner draw) fixed to draw a background and focus rect when the list index is -1.
10-May-2026
- Included the BackColor/ForeColor in the ImageCombo control.
07-May-2026
- The ToolBar/CoolBar control will now react upon WM_THEMECHANGED.
06-May-2026
- Included the ForeColor and RightToLeft property in the HotKey control.
- The HotKey control supports now the WM_PRINTCLIENT message.
05-May-2026
- Text property improved in the HotKey control to return localized 'None' string instead of an empty string. (LoadString on comctl32.dll)
04-May-2026
- Included enum value 'SbrPanelStyleDateTime' for the Style property of a Panel in the StatusBar control.
- Included enum value 'SbrPanelDTFormatGeneral' and 'SbrPanelDTFormatCustom' for the DTFormat property of a Panel in the StatusBar control.
For 'SbrPanelDTFormatCustom' the Text property of a Panel is used for the custom format. (Format$() function)
02-May-2026
- Improvement in the StatusBar control when the Form is maximized.
The UserControl will get the WS_MAXIMIZE style instead of re-creating the StatusBar control.
This allows to apply a different window theme and to not loose it.
01-May-2026
- The MonthView control will now resize upon WM_THEMECHANGED/WM_STYLECHANGED.
- The drop-down calendar in the DTPicker control will now resize upon WM_THEMECHANGED/WM_STYLECHANGED.
- Included the hWndUpDown read-only run-time property in the DTPicker control.
29-Apr-2026
- Bugfix that the size is incorrect for an un-themed drop-down calendar in the DTPicker control. (comctl version 6.1 [Vista+])
- CalendarFont not written to the property bag in the DTPicker control.
28-Apr-2026
- Included the PanelMouseEnter/PanelMouseLeave event in the StatusBar control.
This enables more specific handling of a single panel instead of the global MouseEnter/MouseLeave event.
- Included enum value 'SbrPanelDTFormatMedium' for the DTFormat property of a Panel in the StatusBar control.
27-Apr-2026
- Improvement in the internal SetParts method in the StatusBar control.
Now the SBB_DIVIDER border size is not added when the adjacent panel is hidden.
26-Apr-2026
- Included the TextIndent/PictureIndent property of a Panel in the StatusBar control.
25-Apr-2026
- Included the FontQuality property for all controls where applicable.
This can be convenient when using 'Microsoft Sans Serif' to have more unicode chars supported but to exactly look like 'MS Sans Serif'.
23-Apr-2026
- Included the Resize event in the StatusBar control.
A control container should have such event to re-arrange it's contained controls.
22-Apr-2026
- The StatusBar control is now a ControlContainer like the ToolBar/CoolBar control.
This makes it easier to place a control onto a panel via "Set MyControl.Container = StatusBar".
The MS StatusBar is not a ControlContainer which is a unnecessary limitation.
09-Apr-2026
- Improved the ContainerKeyDown function to remove any WM_LBUTTONDOWN/WM_LBUTTONDBLCLK message
after the button dropdown menu so that we can get a toggle effect in the ToolBar control.
03-Apr-2026
- Improvement in the ContainerKeyDown function in the ToolBar control.
When holding the shift key a 4 - DropDown button will show the button menus instead of clicking the button.
01-Apr-2026
- Improved the MousePointer property in the FrameW control. (e.g. properly show 4 - Hand cursor)
01-Nov-2025
- Included hWndToolTip read-only run-time property to all controls where applicable.
ListView has in addition also the hWndHeaderToolTip read-only run-time property.
15-Jul-2025
- FrameW control would not let you edit controls at design-time when Enabled property is False.
05-Jun-2025
- MultiSelect property does not enforce anymore possible selection change in the ListView control. (like MS ListView)
02-Jun-2025
- Various bugfixes in the ImageCombo control.
Some CB_ messages need to be sent to the superclass window and not to the inner combo handle.
comctl version 5.8x and 6.0 [XP] are not affected.
01-Jun-2025
- Internal improvement in the FontCombo control.
30-May-2025
- Use of IsObject() instead of VarType() = vbObject in the BuddyControl property in the FontComsbo/UpDown/Pager control.
This ensures to safely check for an object whereas VarType() can return the default property of the object.
23-May-2025
- Removed BS_NOTIFY on CommandButtonW/OptionButtonW/CheckBoxW/CommandLink. (like native VB controls)
BN_DOUBLECLICKED therefore is not generated anymore, except for BS_RADIOBUTTON (OptionButtonW) even though BS_NOTIFY is not set.
But OptionButtonW has a DblClick event and therefore is wanted. (like native OptionButton)
A double click will then raise a Click event upon mouse up instead of immediately. (like native VB controls)
This resolves also a side-effect bug in the CommandButtonW control
which raised a Click event when doing a double click on the split button part. (BN_DOUBLECLICKED)
22-May-2025
- DroppedDown property improved in the CommandButtonW control to raise the DropDown event when set to True.
06-May-2025
- Bugfix in the ColumnHeaders.Add when passing a vbNullString text.
05-May-2025
- Regression in the WM_PRINTCLIENT handler on the FrameW control due to changes done on 30-Mar-2025.
16-Apr-2025
- Modified OLEGuids.tlb as following: (compiled with same uuid)
- renamed IDispatch to IDispatchUnrestricted. (used in VTableHandle.bas only which needs to be replaced too)
This allows all the *VB interfaces to use stdole.IDispatch. (better intellisense and just the correct way to do it)
MKTYPLIB expects 'IDispatch' and does not allow to use 'stdole.IDispatch' for OLEAutomation interfaces.
Unregister to old OLEGuids.tlb is not necessary, just overwrite the file.
01-Apr-2025
- Improved the MousePointer property in the LabelW control. (e.g. properly show 4 - Hand cursor)
- Bugfix in the WM_SETCURSOR handler in the ListView control when hot cursor is in place.
30-Mar-2025
- Bugfix that a black line can appear at the top in the FrameW control.
29-Mar-2025
- Modified OLEGuids.tlb as following: (compiled with same uuid)
- included IOleInPlaceObjectWindowless and IOleInPlaceObjectWindowlessVB interfaces.
Unregister to old OLEGuids.tlb is not necessary, just overwrite the file.
27-Mar-2025
- Bugfix in the FrameW control with issues on subframes. (removal of DrawThemeParentBackground as not necessary)
22-Mar-2025
- Scroll wheel down was not working on 64-bit.
25-Jan-2025
- Bugfix in the Add method of LvwColumnHeaders in the ListView control.
The Width argument is now Variant instead of Single which allows to apply 0.
03-Jan-2025
- Included enum value 'SbrPanelAlignmentLeftRight' for the Alignment property of a Panel in the StatusBar control.
The picture will be left-aligned and the text right-aligned. (instead of aligning both together)
If PictureOnRight property is true the logic is reversed. If no picture exists it behaves the same as 'SbrPanelAlignmentLeft'.
02-Nov-2024
- Bugfix for NULL StrPtr() on the .Header property in the LvwGroup class.
31-Oct-2024
- Major performance improvement of the .ListItemIndices property in the LvwGroup class. (comctl version 6.1 [Vista+]; 6.0 remains slow [XP])
- Included the .ListItemCount property in the LvwGroup class. (comctl version 6.1 [Vista+] only)
29-Oct-2024
- Bugfix in the .ContainerKeyDown function in the ToolBar control.
The function will now return Nothing when a popup menu is already present.
13-Oct-2024
- Bugfix in the ListBoxW when Style is 1 - Checkbox or 2 - Option at higher DPI.
26-Sep-2024
- Bugfix in the Text property (vbNullString) in the ImageCombo control.
18-Sep-2024
- The picture of the panels now considered in the internal SetMinHeight method in the StatusBar control.
To "auto size" just set the .Height to 0. (e.g. after removing the pictures)
The same you would do when changing from a large to a small font.
17-Sep-2024
- Bugfix that the Text property was not the default property in the SbrPanel object.
- Included the PictureOnRight property of a Panel in the StatusBar control.
- The Picture of a Panel will now be drawn embossed when the Enabled property is False in the StatusBar control.
Also the grayed text is now drawn using TextOut instead of DrawState for standard VB-ish appearance.
- Bug in the internal ReCreateToolBar method that the button menus picture property was not restored.
14-Sep-2024
- Bugfix in the internal DrawPanel method in the StatusBar control.
09-Sep-2024
- The height of the header will now be adjusted according to ColumnHeaderIcons in the ListView control. (like MS ListView)
06-Sep-2024
- UndoLimit now capped at 1000 in the RichTextBox control.
23-Aug-2024
- Internal improvement in the ToolBar/CoolBar control.
- MaxTextRows property is now allowed to be set to 0 in the ToolBar control.
11-Aug-2024
- All Transparent properties improved to use LAYOUT_RTL on the memory DC, if applicable. (parent)
09-Aug-2024
- Bugfix in the VirtualItemCount property to add flag LVSICF_NOSCROLL. (same behavior as in non-virtual mode)
That flag was meant to fix LVM_SETITEMCOUNT as of IE 3.0.
LVSICF_NOINVALIDATEALL was not added intentionally because the underlying data could be changed for the current page as well.
01-Aug-2024
- Improved the HDN_DROPDOWN handler to remove any WM_LBUTTONDOWN/WM_LBUTTONDBLCLK message
afterwards for the header window only so that we can get a toggle effect on the split button.
This is exactly the same as the Button/ToolbarWindow32 window does for BCN_DROPDOWN/TBN_DROPDOWN. Bug in the SysListView32?
The improvement is most useful when showing a popup menu as drop-down.
26-Jul-2024
- LB_SETTABSTOPS now cached in the VListBox control to replicate MS ListBox behavior.
The ListBoxW control also caches these in case the Style property is 1 - Checkbox or 2 - Option.
When an app is not using LB_SETTABSTOPS then the defaults are in use and no difference therefore.
25-Jul-2024
- Bugfix that the Text property was not the default property in the LvwListSubItem object.
19-Jul-2024
- Use of GetTabbedTextExtent instead of GetTextExtentPoint32 for the GetIdealHorizontalExtent function in the ListBoxW/VListBox control.
When the UseTabStops property is False then GetTextExtentPoint32 is used.
24-Jun-2024
- Support for adding an .Image object from a PictureBox to the CoolBar/CbrBand/TbrButtonMenu.
Prior to this update the .Image object needed to be persisted into the .Picture property of the PictureBox.
22-Jun-2024
- Use of integer division \ instead of double division / where applicable.
This does not mean that \ was never used, just all division operators got reviewed.
29-May-2024
- Bugfix that setting SelectedItem to Nothing will not fire Click event, if index changed, in the ImageCombo control.
25-May-2024
- Improved the ImageList (Variant) property on each control to accept a handle value. (hImageList)
This can be convenient to apply a system image list for example.
To note is that a key (string) image index will then fail in this case of course.
08-May-2024
- Support for WMF/DIB/EMF/BMP and FileNameW clipboards in the PasteSpecialDlg method in the RichTextBox control.
05-May-2024
- Included the PasteSpecialDlg method in the RichTextBox control.
Ctrl+Alt+V shortcut now invokes the paste special dialog box.
The AutoVerbMenu is added with a paste special menu entry.
01-May-2024
- Included the hMenu run-time property in the TbrButton object.
Returns/sets a handle to a popup menu which will be used as a button dropdown menu.
This is useful when a menu with submenus is needed.
- Included ButtonMenuClick2 event in the ToolBar control.
28-Apr-2024
- ClientWidth/ClientHeight property now Let-able in the TabStrip control.
23-Apr-2024
- Included the Span/UpTo method in the RichTextBox control. (richtx32.ocx compatibility)
20-Apr-2024
- Included optional wFormat for the CanPaste function.
- Localized strings for the AutoVerbMenu.
18-Apr-2024
- Ctrl+Alt+V shortcut changed to Ctrl+Shift+V as this is common for Me.PasteSpecial CF_UNICODETEXT.
Menu text changed from 'Paste Special' to 'Paste as plain text'.
Ctrl+Alt+V should be reserved for a paste special dialog box to choose a format. (like Wordpad)
17-Apr-2024
- Included the AutoVerbMenu in the RichTextBox control.
Ctrl+Alt+V shortcut does now a paste special.
12-Apr-2024
- Included the Resize event in the FrameW control. (like the VB.Picture control)
A control container should have such event to re-arrange it's contained controls.
However, the VB.Frame control does not have it.
10-Apr-2024
- Included the AlwaysFindExact property in the ComboBoxW/FontCombo/VirtualCombo control. (LB_FINDSTRING -> LB_FINDSTRINGEXACT)
This also changes the behavior of automatically selecting an item when the user drops down the list of the control.
23-Mar-2024
- Accelerator keys support in a VBA environment. (PreTranslateMsg)
07-Feb-2024
- Included the BorderStyle property in the ProgressBar control.
30-Jan-2024
- Included the OLEDragDropScrollOrientation property in the ListView control.
24-Jan-2024
- Included the AllowDropFiles property and DropFiles event in the ListView control.
- Included the Transparent property in the TabStrip control.
21-Jan-2024
- Included the OLEDragMode property in the RichTextBox control.
18-Jan-2024
- CoolBar control accepts now child objects that do not expose a hWnd property.
New function GetWindowFromObject in VTableHandle.bas.
17-Jan-2024
- Included the MousePointer property in the UpDown control. (not exist in MS UpDown)
- DownClick/UpClick for UpDown/SpinBox now fires upon WM_CAPTURECHANGED where
cached delta value on UDN_DELTAPOS decided if down or up click. (like MS UpDown)
ByRef Delta on BeforeChange event copied back to iDelta of the NMUPDOWN structure upon UDN_DELTAPOS.
16-Jan-2024
- Final bugfix in the UserControl_Resize for the ImageCombo control. (regression 18-Dec-2023)
- MousePointer covers now the whole SpinBox. (incl. border and up down control)
Also bugfix in the MouseTrack property as WM_NCMOUSEMOVE was not covered.
WM_NCLBUTTONDOWN will set focus for the edit control as the border of the up down control does also.
15-Jan-2024
- Fixed focus issue for the up down button in the DTPicker control.
14-Jan-2024
- Improvement in the BuddyControl property in the UpDown control.
10-Jan-2024
- Bugfix for WM_LBUTTONDOWN/WM_RBUTTONDOWN handler on ListView/TreeView/ImageCombo control.
Those windows controls do have an internal DragDetect modal message loop.
08-Jan-2024
- Update of edit text when changing list index by code in the VirtualCombo control.
This is needed due to missing CBS_HASSTRINGS and set of LBS_NODATA. (which is correct so)
It now also handles LB_FINDSTRINGEXACT message in the WindowProcList.
06-Jan-2024
- Included the CueBannerAlways property in the TextBoxW control.
- "Object.Default" not written anymore to the property bag in CommandButtonW/CommandLink control.
- The Default and Cancel property are now also available when setting to a shadow object. ('Set' command)
Affected are only the CommandButtonW/CommandLink control.
03-Jan-2024
- Included the AllowDropFiles property and DropFiles event in the ListBoxW control.
02-Jan-2024
- Bugfix in the UserControl_Resize in the ComboBoxW/FontCombo/VirtualCombo/ImageCombo control. (regression 18-Dec-2023)
01-Jan-2024
- Included the WindowedLabel control.
31-Dec-2023
- Const VARIANT_CB now 24 instead of 16 for Win64.
29-Dec-2023
- Included the SingleLine property in the LabelW control.
28-Dec-2023
- Included the Resize event in the ToolBar control. (like in the CoolBar control)
- Included the MimicTextBox property in the LabelW control. (DT_EDITCONTROL)
22-Dec-2023
- Included AllowDropFiles property in the RichTextBox/TextBoxW control.
- Included DropFiles event in the TextBoxW control.
20-Dec-2023
- Included the DropFiles event in the RichTextBox control. (EN_DROPFILES)
19-Dec-2023
- Included OLEDragDropScroll/OLEDropMode and related UserControl events in the RichTextBox control.
Renamed OLEDragDrop to OLEDragDropRTF. OLEDragDropRTF is the auto-mode by rich edit control.
18-Dec-2023
- Adjustment needed in the UserControl_Resize in the ComboBoxW/FontCombo/VirtualCombo/ImageCombo control. (regression 10-Dec-2023)
10-Dec-2023
- Improvement in the internal CheckDropDownHeight method in the ComboBoxW/FontCombo/VirtualCombo/ImageCombo control to match MS control on edge cases.
11-Nov-2023
- RichTextBox/LinkLabel now react upon WM_PAINT where wParam is a hDC.
05-Nov-2023
- CoolBar/ToolBar/TabStrip/StatusBar control now redirects to WM_PRINT (PRF_CLIENT Or PRF_ERASEBKGND) upon WM_PAINT when wParam is <> 0.
- All Transparent properties improved to use GetParent() instead of .ContainerHwnd.
24-Oct-2023
- OLEDragDropScroll property now adds the scroll bar sizes for the auto scroll margin.
[...]
11-Nov-2012
- First release.
Warning: This Std-EXE version here is not really IDE-Safe as the design-time (form designer) user control subclassing (AddressOf pointer) can just become invalid when the IDE wants to. It is recommended to use the OCX version.
Re: CommonControlsEx (Replacement of the MS common controls)
The benefit is that these controls are linked to the comctl32.dll, that means they support the latest API calls, functions, properties and visual styles (themes).
The existing common controls 6.0 from MS are not linked to the comctl32.dll, so they doesn't support the visual styles (themes).
Reason why: The controls of the comct32.dll are compiled directly into the common controls 6.0 from MS, but as of state of a old version of comctl32.dll
Only the common controls 5.0 from MS are linked to the comctl32.dll, but the COM hull is very old and so they have a leak of the latest functions and properties. Also controls like the DTPicker, MonthView or UpDown are not included.
Re: CommonControlsEx (Replacement of the MS common controls)
Originally Posted by Krool
The benefit is that these controls are linked to the comctl32.dll, that means they support the latest API calls, functions, properties and visual styles (themes).
The existing common controls 6.0 from MS are not linked to the comctl32.dll, so they doesn't support the visual styles (themes).
Reason why: The controls of the comct32.dll are compiled directly into the common controls 6.0 from MS, but as of state of a old version of comctl32.dll
Only the common controls 5.0 from MS are linked to the comctl32.dll, but the COM hull is very old and so they have a leak of the latest functions and properties. Also controls like the DTPicker, MonthView or UpDown are not included.
Can you please change the OLEGuids.tlb to a new name to avoid conflicts with my existing OLEGuids.tlb in system32 folder?
Re: CommonControlsEx (Replacement of the MS common controls)
Excellent work!
Originally Posted by Hack
What is the benefit of using these over the existing controls?
Does each control have the same properties? Do they have new properties?
In addition to what Krool stated, some folks, myself included, prefer that their apps have no dependencies whatsoever.
The controls have most of the necessary (similarly named) properties and methods and many of them have some new ones as well (the VisualStyles property for instance).
Originally Posted by Jonney
Can you please change the OLEGuids.tlb to a new name to avoid conflicts with my existing OLEGuids.tlb in system32 folder?
Open CommonControlsEx.vbp in any text editor and edit this line:
Code:
Reference=*\G{5B1EACE0-EDEB-11E1-AFF1-0800200C9A66}#1.0#0#..\..\..\..\WINDOWS\system32\OLEGuids.tlb#OLE Guid and interface definitions
to:
Code:
Reference=*\G{5B1EACE0-EDEB-11E1-AFF1-0800200C9A66}#1.0#0#OLEGuids\OLEGuids.tlb#OLE Guid and interface definitions
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Re: CommonControlsEx (Replacement of the MS common controls)
Originally Posted by Jonney
Can you please change the OLEGuids.tlb to a new name to avoid conflicts with my existing OLEGuids.tlb in system32 folder?
You can just rename the file "OLEGuids.tlb" at your own, for example to "OLEGuids2.tlb"
That is no problem, because the uuid and library name differs from the original. They can co-exist without conflicts.
You just need to re-register it in the IDE. (Project -> References... -> Browse for file)
Re: CommonControlsEx (Replacement of the MS common controls)
Originally Posted by Krool
You can just rename the file "OLEGuids.tlb" at your own, for example to "OLEGuids2.tlb"
That is no problem, because the uuid and library name differs from the original. They can co-exist without conflicts.
You just need to re-register it in the IDE. (Project -> References... -> Browse for file)
Thanks. I understood.
If you can add Unicode support, then those control can be used on PC with whatever locale setting.
How about others control built by CreateWindowEx such as Listview/Treeview? Listview support more new features such as Grouping now.
Re: CommonControlsEx (Replacement of the MS common controls)
Thanks for the update!
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Re: CommonControlsEx (Replacement of the MS common controls)
Originally Posted by Krool
Update released.
All controls support now Unicode and some other minor improvements are done.
Fairly support Unicode.
But because of nature of MS BUTTON, it doesn't an unicode compatible control.
Never mind, just leave this because it's hard to fully support Unicode for a Command button.
DrawText hDC, StrPtr(Button.Caption), -1, RectText, DT_CALCRECT Or DT_WORDBREAK
Button.Caption can never be held Unicode string, internal conversion has been done before you call DrawTextW.
Re: CommonControlsEx (Replacement of the MS common controls)
Originally Posted by Jonney
Button.Caption can never be held Unicode string, internal conversion has been done before you call DrawTextW.
This function will retrieve any button's caption, even if VB displays their Unicode captions as ?????.
Code:
Private Declare Function DefWindowProcW Lib "user32.dll" (ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Function GetCaption(ByRef oButton As Object) As String
Const WM_GETTEXT = &HD&, WM_GETTEXTLENGTH = &HE&
Dim Button_hWnd As Long
On Error GoTo 1
Button_hWnd = oButton.hWnd
GetCaption = Space$(DefWindowProcW(Button_hWnd, WM_GETTEXTLENGTH, 0&, 0&))
DefWindowProcW Button_hWnd, WM_GETTEXT, Len(GetCaption) + 1&, StrPtr(GetCaption)
1 On Error GoTo 0
End Function
VB's Button controls (CommandButton, CheckBox or OptionButton) can actually contain Unicode captions (via DefWindowProcW + WM_SETTEXT). VB doesn't display them properly though.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Re: CommonControlsEx (Replacement of the MS common controls)
Thanks for including the StatusBar control!
Last edited by Bonnie West; Mar 1st, 2013 at 04:52 PM.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Re: CommonControlsEx (Replacement of the MS common controls)
its really an amazing work,god bless you.Bro can you add listview and treeview with displayable unicode support?
it will great achievment if it possible
Re: CommonControlsEx (Replacement of the MS common controls)
Update released.
ListView control is added.
Groups and 'Tile' View are for the moment not included.
It can replace 100% the ListView from „MSCOMCTL.OCX". (Exception: ToolTipText of the ListSubItems)
But it has also many properties, methods and events more than the original.
Re: CommonControlsEx (Replacement of the MS common controls)
Originally Posted by Krool
Update released.
ListView control is added.
Groups and 'Tile' View are for the moment not included.
It can replace 100% the ListView from „MSCOMCTL.OCX". (Exception: ToolTipText of the ListSubItems)
But it has also many properties, methods and events more than the original.
Thank you for additional Listview.
From Vista/Win7,MS added lots of new features into Listview, such as enhanced grouping, Checkbox on Header,etc.
Please consider adding checkbox and Text Edit for subitems.
Re: CommonControls (Replacement of the MS common controls)
Update released.
ImageList control is completly rewritten. (It is not compatible with the previous version)
It works now like the original ImageList from MS but with some improvements, for example that the Style flag of the ListImages Draw method can be combined with multiples styles. (That was not possible in the original ImageList from MS) or that the Overlay function returns an icon instead of a bitmap or that the BackColor can be turned on or off (UseBackColor property).
Re: CommonControls (Replacement of the MS common controls)
I must say I'm truly impressed. Were I still using VB6, this would have been an incredible source of knowledge. I tended to write alot of my own controls(I still do in VB.Net) and I always want to learn as much as possible about creating them. I thought I had a good handle on it it but one glance at your source code, and even what you described about them being linked to ComCtl32.Dll showed me just how little I actually knew about control authoring in VB6. I tip my hat to you sir.
C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter
There's just no reason to use garbage like InputBox. - jmcilhinney
The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber
Re: CommonControls (Replacement of the MS common controls)
Update released.
ImageCombo control is added.
The biggest advantage is that you can set the style property. ('DropDownCombo', 'DropDownList' or 'SimpleCombo')
That was not possible on the original ImageCombo control. (It was always as 'DropDownCombo')
Also new is the 'ItemDrag' event, similar to the one used in the ListView control.
Re: CommonControls (Replacement of the MS common controls)
Very, very good work. Many thanks to you. I do not like to link to Microsofts Ocx-files (Mscommctl.....). With your controls i don't need that. My exe work so without registrations on every PC. And: i can do more things. I can change the WM_PAINT - message to what i will. I can change the colors, i can add a picture, i can paint the control. I must only change your code a little bit. Awsome.
Thank you very much!!!!!
Re: CommonControls (Replacement of the MS common controls)
Thank you for the work - it's a lovely change CommonControls.
I have one problem, very often crashes when you compile an application (even an example), and the exe-file is created. And sometimes crashes when you press End in the course of the program.
It would be nice if the progress bar for added display of progress on the taskbar. An example can be found here http://sourceforge.net/p/audica/code...skBarList3.cls
Re: CommonControls (Replacement of the MS common controls)
Also for the beautiful subsclassing commandbutton think it will be good to make changes if there is a caption and a picture, you have the image on the left and the caption to the left of the picture. So the picture will not be imposed on the text.
Code:
Private Sub DrawButton(ByVal hWnd As Long, ByVal hDC As Long, Button As Object)
.....
If Not Button.Caption = vbNullString Or Len(Button.Caption) > 0 Then
Set ButtonFont = Button.Font
FontOld = SelectObject(hDC, ButtonFont.hFont)
RectText = RectClient
DrawText hDC, StrPtr(Button.Caption), -1, RectText, DT_CALCRECT Or DT_WORDBREAK
RectText.Right = RectClient.Right
If ButtonPic Is Nothing Then
RectText.Left = RectClient.Left
RectText.Top = ((RectClient.Bottom - RectText.Bottom) / 2) + 3
RectText.Bottom = RectText.Top + RectText.Bottom
Else
RectText.Left = CInt(Button.Parent.ScaleX(ButtonPic.Width, vbHimetric, vbPixels)) + 4
'RectText.Top = RectClient.Top '(RectClient.Bottom - RectText.Bottom) + 1
RectText.Top = (((RectClient.Bottom - RectClient.Top) - (RectText.Bottom - RectText.Top)) / 2) + RectClient.Top
RectText.Bottom = RectClient.Bottom
End If
DrawThemeText Theme, hDC, 1, ButtonState, StrPtr(Button.Caption), -1, DT_CENTER Or DT_WORDBREAK, 0, RectText
SelectObject hDC, FontOld
End If
CloseThemeData Theme
If Not ButtonPic Is Nothing Then
W = CInt(Button.Parent.ScaleX(ButtonPic.Width, vbHimetric, vbPixels))
H = CInt(Button.Parent.ScaleY(ButtonPic.Height, vbHimetric, vbPixels))
If Not Button.Caption = vbNullString Or Len(Button.Caption) > 0 Then
X = RectClient.Left
'Y = RectClient.Top ' + ((RectClient.Bottom - RectClient.Left - H) / 2)
Y = (((RectClient.Bottom - RectClient.Top) - H) / 2) + RectClient.Top
Else
RectClient.Bottom = RectText.Top
X = RectClient.Left + ((RectClient.Right - RectClient.Left - W) / 2)
Y = RectClient.Top + ((RectClient.Bottom - RectClient.Left - H) / 2)
End If
If Enabled = True Then
If Button.UseMaskColor = True Then
Call DrawTransparentPicture(ButtonPic, hDC, X, Y, W, H, WinColor(Button.MaskColor))
Else
ButtonPic.Render hDC, X, Y + H, W, -H, 0, 0, ButtonPic.Width, ButtonPic.Height, ByVal 0
End If
Else
Call DrawDisabledPicture(ButtonPic, hDC, X, Y, W, H, WinColor(Button.MaskColor))
End If
End If