VB Common Controls Replacement Library (Replacement of the MS common controls)
This project is intended to replace the MS common controls for VB6.
http://www.vbforums.com/showthread.php?698563-CommonControls-(Replacement-of-the-MS-common-controls)
VB Common Controls Replacement Library
License: MIT License
VB Common Controls Replacement Library (Replacement of the MS common controls)
This project is intended to replace the MS common controls for VB6.
http://www.vbforums.com/showthread.php?698563-CommonControls-(Replacement-of-the-MS-common-controls)
When compiling projects. A Compile error "ByRef Argument Type Mismatch" occurs in a function 'Original_IPPB_GetDisplayString' in 'VtableHandle.bas'.
The function is declared as
Private Function Original_IPPB_GetDisplayString(ByRef This As Long, ByVal DispID As Long, ByRef pDisplayName As Long) As Long
So, 'pDisplayName' is ByRef Long, but it is used to call ShadowIPPB.GetDisplayString which seems to need String.
sorry for my poor english.
If a CommandButtonW is placed on another UserControl and that Control is compiled into an ocx the Double Click "Jump to source" feature does not work on the host control in the IDE. This seems to only be a problem if the CommandButtonW style is set to graphical.
I found this in WindowProcControl line 2012:
Case WM_LBUTTONDBLCLK
If (GetWindowLong(hWnd, GWL_STYLE) And BS_OWNERDRAW) = BS_OWNERDRAW Then
' Buttons having the BS_OWNERDRAW style will not respond to double click as normal buttons do.
' Thus the default window procedure of the button will be called with WM_LBUTTONDOWN instead of the actual WM_LBUTTONDBLCLK.
WindowProcControl = ComCtlsDefaultProc(hWnd, WM_LBUTTONDOWN, wParam, lParam)
Exit Function
End If
So if the button is graphical its window style gets the BS_OWNERDRAW set and it swallow the double click events the IDE needs?
Regards,
Hi,
From the docs it looks like the slider Win32 control would support custom drawing: https://docs.microsoft.com/en-us/windows/win32/controls/nm-customdraw-trackbar
Would it be hard to add OwnerDraw support into the Slider control? Feel free to not do it of course, just would be useful if it's fairly straight forward to add in.
To reproduce:
Create a blank project with a TextBox and a ListView
Copy and paste this code:
Private Sub Form_Load()
Call ListView1.ListItems.Add(1, "key", "text")
ListView1.HideSelection = False
End Sub
I think the constant FR_HIDEMATCHCASE should be &H8000&
But its declared in CommonDialog.cls line 409:
Private Const FR_HIDEMATCHCASE As Long = &H8000
There is a problem that a Textbox bound to a Datasource does not update the Datasource properly if the Textbox loses focus by clicking on another control - leaving the Textbox with Tab Key works. This only happens in the IDE, in the compiled .exe it works.
I am using the VBCCR16.ocx but I assume its also a problem in VBCCR17. Maybe other controls are affected by this too.
The problem is easy to reproduce:
Create a new exe project.
Place two textboxes on the form.
Add a reference to ADODB.
Place the following code in Form_Load:
Dim Data As ADODB.Recordset
Set Data = New ADODB.Recordset
Data.Fields.Append "aString", adVarChar, 25
Data.Open , , adOpenStatic, adLockBatchOptimistic
Data.AddNew Array("aString"), Array("123")
Data.UpdateBatch
TextBoxW1.DataField = "aString"
TextBoxW2.DataField = "aString"
Set TextBoxW1.DataSource = Data
Set TextBoxW2.DataSource = Data
If you run the program in the IDE and change the text in one textbox and tab away the other textbox's text changes.
If you instead click on the other textbox its text is not updating (the underlying datasource is not updated).
Hi,
control which use an imagelist (e.g. TabStrip, Listview) do not unload properly when imagelist is set from the property page designer.
I use several custom controls and the UserControl_Terminate() event is never raised. This becomes a real problem if these custom controls are not placed on your main form, because they leak GDI handles.
My workaround at the moment is setting the imagelist per property at runtime e.g. in UserControl_Initialize:
myListView.Icons = myImagelist.object.
Then everything works fine.
I tried to locate the problem in the source but no chance.
By the way great controls! Keep up the good work.
Forgot to mention: I use the ocx library.
Hey,
I'm looking to use this in an existing project, with the OCX version. I've registered it and have linked it to the project, along with OLEGuids.tlb.
I've updated some of the standard controls to point to the VBCCR16 ones. When I double click on some of the forms in VB6, the RTE 713 comes up, with VBCCR in the warning message title. Likewise when I try to run the application.
I can't reproduce it with a brand new project though.
So I'm not expecting a resolution, just maybe someone has come across it before or might have any thoughts on what it could be or where to look into it?
Hi,
I've found out that the following code makes the Windows 10 emoji IME work correctly with these controls in VB6 apps:
Case WM_IME_CHAR
SendMessage hWnd, WM_CHAR, wParam, ByVal lParam
Exit Function
But in the code I can see a lot more special handling, e.g. the ComCtlsPeekCharCode
stuff. Can you tell me when this extra code is necessary? I have deactivated it and so far cannot see any difference.
Awesome work by the way. ๐
Best regards
Hello
You made great help to all of us.
i started to use ocx and control version noticed bug on richtext change event.
Normally i used original richtext ocx do this.
when textarea is bigger its auto scroll to last line.
with change event on richtext
richtext.SelStart = richtext.hWnd
also try this
richtext.SelStart = richtext.hWndUserControl
both seems not working. i try to debug on controls but seems taking much time so i am reporting to you may be you can find faster then me?
regards,
Apologies for the previous incorrect bug report. Here's the correct one:
In IPPB_GetPredefinedStrings
, you'll see this:
pCaStringsOut.cElems = cElems
pCaStringsOut.pElems = pElems
For nElemCount = 0 To cElems - 1
lpString = CoTaskMemAlloc(Len(StringsOutArray(nElemCount)) + 1)
CopyMemory ByVal lpString, StrPtr(StringsOutArray(nElemCount)), 4
CopyMemory ByVal UnsignedAdd(pElems, nElemCount * 4), ByVal lpString, 4
Next nElemCount
First, note that you haven't copied the content of the string into lpString
, you've just moved the StrPtr around.
Ultimately what's actually happening here is that the pElems
array just gets filled with the direct pointers from StrPtr(StringsOutArray(nElemCount))
, so you've essentially populated the LPOLESTR array with BSTRs instead. This is a problem, because the caller is responsible for freeing the strings, and so it calls CoTaskMemFree
on the BSTR, which is invalid and causes an immediate exception that I can see under a native debugger.
Apologies, false alarm... can delete this :)
Set getItem = ListView.ListItems(key) ' throws an error but:
If ListView.ListItems.count = 0 and Not ListView.ListItems.exists(key) Then
Set getItem = ListView.ListItems(key) ' throws an error
end if
' Expected ListView.ListItems(key) to return Nothing rather than throw an error.
Please create the VBCCR wiki for all of us to help you create and add documentation.
Hi,
it seems MouseEnter is never triggered, at least with TextBoxW and ListBoxW controls.
Can you please, look?
Appreciate, and good day to you!
Could scrollbar controls be added to this project please? I think all other standard controls are there, but not the scrollbars,
To reproduce,
ListView.Visible = false
ListView.SetFocus()
The bug is in ListView.cls and is pretty simple to fix:
Public Sub SetFocus()
+ If Me.Visible then ' Add this if check
Extender.SetFocus
+ End If
End Sub
I tried the VBCCR16 ListView as a nearly drop-in replacement for the ComctlLib ListView but discovered that whereas the ComctlLib ListItem Key is read/write, the LvwListItem Key is read-only. Is there a reason it is not read/write?
Hi Krool, I'd like to thank you and express my respect to the project you have built and maintain.
Your controls are great and stable so I implemented some of them my software product in Serbia. If there is something you need help with, I'd be glad to do that (if capable :)
As for the issue, it's about referencing the VBCCR library (or any of user-controls built using VBCCR components) from VB.net (tried versions 2013-2017).
VB.net interops with ActiveX controls making a wrapper automatically. It works for MSHFlex, my own VB6 built user controls, and some other controls I've tried. But when referencing VBCCR13.ocx (or VBCCR15.ocx) following warning errors occur preventing Vb.net to build the wrapper:
1.Error loading type library/dll (TYPE_E_CONTLOADLIBRARY) - 0x80029C4A
2.Could not determine the dependencies of the COM reference "VBCCR15". Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY))
3.Could not determine the dependencies of the COM reference "VBRUN". Type mismatch. (Exception from HRESULT: 0x8002802A (TYPE_E_WRONGTYPEKIND))
4.The referenced component 'VBCCR15' could not be found.
Now, I must mention that the component is registered correctly and fully functional from within VB6.
Note
The question is, do you have any idea, or some advice what should I do, or where to start looking in the source code to help resolve this issue, and make VBCCR referable from within VB.net ?
Thanks andd best regards,
Milan
TextBoxW contained in another custom UserControl doesn't de reference when UC gets terminated. In these cases when the form gets unloaded, TextBoxW doesn't terminate with it. Instead it lives until the end of application producing crashes (protected memory read) on the exit.
It happens when the TextBoxW control looses focus by clicking on certain type of controls (MSHFlexGrid, MSFlexGrid,...) on the same form. It doesn't happen if the focus is lost by tabbing or using other keyboard methods.
To investigate the code I've made a project group containing VBCCR16.vbp and a small exe (Crash.vbp) containing a simple UserControl having a PictureBox with TextBoxW on it.
The main form Crash.frm contains MSHFlexGrid, CommandButton and a UserControl on it.
I made some changes so that TextBoxW shows its Reference Counter on request.
These are the steps to reproduce the problem:
When number of references is 6, the TextBoxW doesn't terminate on form unload, but strangely, both the UserControl containing it and the Form does. That makes me think that it somehow holds the reference to itself.
This doesn't happen when TextBoxW is hosted directly on the form or PictureBox placed on the form. In that case, clicking or tabbing to MSHFlexGrid drops references to 5.
Examining the messages shows equal patterns in all cases of focus switching.
Do you have any clue of what could be the reason ?
I can give you a project group I've made if this is of any interest to you.
BTW, the code you made is AMAZING !!!
There are many difficult concepts and hacks I wasn't aware VB6 is capable of. I can only imagine the time and effort you've invested in it. Brilliant...
This problem happens only after compiling an app, not in the IDE. In the IDE it's all OK.
It seems that, differently from an ordinary frame, on a FrameW the events OLEDragDrop and OLEDragOver are not triggered when dropping something.
As a workaround, a picturebox inside the frame does the trick.
When an OptionButtonW is set to be OwnerDraw, the Click event isn't being raised. The value still seems to be updating though.
To reproduce:
VBCCR18.OCX 2024.7.26 ๏ผ LabelW1 control cannot wrap automatically, SingleLine=false does not work
There seems to be a bit of an odd behaviour in the RichTextBox compared to the standard one.
.SelStart and .SelLength seem to return indexes based on the text using just a single new line "\n" (vbLf), where as the .Text uses return as well, "\r\n" (vbCrLf).
You can see it in the RichTextBoxForm sample if you add this code:
Private Sub RichTextBox1_KeyPress(KeyChar As Integer)
Debug.Print RichTextBox1.SelStart & " out of: " & Len(RichTextBox1.Text)
End Sub
If you run it and just add text to the end of the first line, it's fine they both match up.
But when press enter, it become different by 1, and gets further out for each line break.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.