Perhaps you can only modify your icon to add one or more columns of pixels to its left.
Printable View
Another error occurs here:
The error message:Code:With New CommonDialog
.HelpFile = sHelpFile ' = C:\\...\VBENLR98.CHM
.HelpCommand = CdlHelpContext
.HelpContext = nContextID ' = 1000011
.ShowHelp
End With
It seems that the CommonDialog can't show any of VB6 CHM files.Code:---------------------------
Windows Help
---------------------------
The C:\Program Files\Microsoft Visual Studio\MSDN\2001OCT\1033\VBENLR98.CHM file is not a Windows Help file, or the file is corrupted.
---------------------------
ОК
---------------------------
I've got the HelpFile from the Err.HelpFile and HelpContext from Err.HelpContext (division by zero)
I haven't seen it mentioned here or in the changelog and haven't seen you around the tB Discord; so just wanted to relay a bug we had found that impacts VBCCR too: When the TreeView_NodeClick event fires, .SelectedItem is not up to date (it is for comctl32 and mscomctl TVs). So if you use .SelectedItem within your event handler, it won't be referring to the same item as the Node object.
VBCCR v1.7.49
Windows 10
VB6SP6
Im want to implement a dark mode for my app and change the backcolor and forecolor of all controls on a form.
The problem starts with the controls CheckBoxW and OptionButtonW:
I can set & change the backcolor but changing the ForeColor doesnt change the text color.
Changing the forecolor of controls like LabelW or TextBoxW works fine.
I know i can disable the use of the VisualStyles for these controls, but this is no solution.
Does anyone know a solution to force CheckBoxW and OptionButtonW to use the new forecolor? Maybe via SendMessage?
Or with a API call to rewrite the caption text using a new color?
@Nouyana @Krool Both is true: when the item is not in the list and the style is set to FtcStyleDropDownList then you'll get the error - you have to add the new item before you may set it as text; when it is in the list already this entry becomes the selected one.
The number of members cannot be obtained for VB6 class objects compiled into EXE.
Other third-party OCX controls can be obtained by adding .OBJECT
Code:Msgbox GetMethodCount(Class1A) '0
Msgbox GetMethodCount(WebBrowser1) '0
Msgbox GetMethodCount(Web) '19
Msgbox GetMethodCount(WebBrowser1.Object) '19
Msgbox GetMethodCount(WebBrowser1.Document) '379
Msgbox "DataGrid1 METHOD=" & GetMethodCount(DataGrid1) '0
Msgbox "DataGrid1.Object METHOD=" & GetMethodCount(DataGrid1.Object) '111
Code:Function GetMethodCount(Obj1 As Object) As Long
Dim oITypeInfo As olelib.ITypeInfo, vAttrs As TYPEATTR, vTable As Long
Dim oIDispatch As olelib.IDispatch, pAddress As Long, Fptr As Long
Set oIDispatch = Obj1 ' get the IDispatch interface
Set oITypeInfo = oIDispatch.GetTypeInfo(0, 0)
'Msgbox oITypeInfo.GetFuncDesc(0)
Dim fundisp As Long
On Error GoTo err1
'CallCOMInterface& ObjPtr(oITypeInfo), 6, 0&, VarPtr(fundisp)
fundisp = oITypeInfo.GetFuncDesc(0)
If fundisp <> 0 Then
pAddress = oITypeInfo.GetTypeAttr
CopyMemory vAttrs, ByVal pAddress, Len(vAttrs) ' copy that structure
oITypeInfo.ReleaseTypeAttr pAddress
GetMethodCount = vAttrs.cFuncs
End If
Exit Function
err1:
End Function
@Krool, is it possible to add a Lock (or Locked) property to all VBCCR controls? The Lock property is different from the Enabled property, and it is very useful in many cases.
VB6SP6, Win10 (latest), VBCCR 1.7.49
@Krool
I have a problem with the border draw of a multiline textbox with scrollbars=both and borderstyle=CCBorderStyleSingle.
The border is only drawn around the text field and not including the visible scrollbars:
Attachment 187941
VBCCR TextBox Multiline CCBorderStyleThin:
Attachment 187942
VBCCR TextBox Multiline CCBorderStyleSunken:
Attachment 187943
v1.7.0.55 (2023-05-17) doesn't work with "true" unicode. VBFlexGrid.CellToolTipText does work:
Attachment 187974Code:Private Sub Command1_Click()
With VBFlexGrid1
.Row = 1: .Col = 1
.ShowInfoTips = True
.CellToolTipText = "ABC " & ChrW$(-17827)
CommandButtonW1.ToolTipText = "ABC " & ChrW$(-17827)
End With
End Sub
Question for Krool: Your imagelist. Do all the images contained within a single imageList have to be the same size? I notice that the width/height seems to inferred from the first image that is loaded into the list and that implies that they all need to be the same size from that point on.
If this is the case, have you thought about adding an additional option to allow images of differing sizes to co-exist within the same imageList? It would be a useful storage structure if so.
Ok, this must be kind of a new "feature" by MS.
It seems having WS_BORDER together with WS_HSCROLL and WS_VSCROLL at edit control creation causes this problem.
I test it by not adding WS_BORDER at creation but change later on, which worked. Will fix it soon.. thanks
No, the height/width must be specified on ImageList_Create, so it cannot contain multiple images with different sizes.
For a TextBox control it's clear what Locked vs Enabled means. But for other controls it's more difficult. Let's say a Slider control. How different can a Locked be vs Enabled ?
The CommonDialog.ShowHelp (WinHelpW function) works not on CHM files.
The WinHelp system used HLP files; the newer HTMLHelp system used CHM files
VB6SP6, Win10 (latest), VBCCR 1.7.49
@Krool
I try to vertical align a character in the CommandButtonW control and it looks like the VerticalAlignment property is buggy:
Attachment 188005
1. Button: CCVerticalAlignmentTop
2. Button: CCVerticalAlignmentCenter
3. Button: CCVerticalAlignmentBottom
CCVerticalAlignmentTop = the character is displayed at the bottom and outside of the control
CCVerticalAlignmentCenter = the character is not displayed in the center
CCVerticalAlignmentBottom= the character is displayed at the top
The internal calculation for top/bottom align is swapped and the calculation for center & bottom align is not correct too.
It seems like the calculation doesnt respect the font size & style (e.g. bold). The used font size on the screenshot above is 24/bold.
Can you fix this?
1. Button properties:
Attachment 188006
How about using the API GetTextExtentPoint32 to determine the real height of the current caption text and then calculate the correct position using the button boundaries?
Here is some code to do this:
Code:
Private Type SIZE
Width As Long
Height As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function GetTextExtentPoint32 Lib "gdi32" _
Alias "GetTextExtentPoint32A" (ByVal hDC As Long, _
ByVal lpsz As String, ByVal cbString As Long, lpSize As SIZE) _
As Long
Public Declare Function SendMessageAny Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Dim nSize As SIZE
dim sCaption as String
dim cHDC as long
Dim cRECT As RECT
dim cHeight as long
Dim cHWND as long
dim lTextHeight as long
dim lCenterStartPos as long
dim lTopStartPos as long
dim lBottomStartPos as long
sCaption = commandbutton.caption
cHDC = commandbuttonw.hDC
cHWND = commandbuttonw.hWnd
' get the Caption text height
GetTextExtentPoint32 cHDC, sCaption, Len(sCaption), nSize
lTextHeight = nSize.Height
' get the button sizes
SendMessageAny cHWND , EM_GETRECT, 0, cRECT
cHeight = cRECT.Bottom - cRECT.Top
' correct center position:
lCenterStartPos = (cHeight - lTextHeight) / 2
' correct top position:
lTopStartPos = cRECT.Top
' correct bottom position
lBottomStartPos = cRECT.Bottom - lTextHeight
Concerning this the VB.TextBox has the same issue. So this is a "new" MS bug.
VB.TextBox Appearance must be set to 0 - Flat.
Attachment 188014
VB6SP6, Win10 (latest), VBCCR 1.7.49
@Krool
i found a small bug using the ProgressBar in the IDE:
the displayed text in the ProgressBar is not redrawed when changing the font.
I have to change the text property to force a redraw with the new font settings.
Nothing critical but i guess easy to fix ;-)
Update released.
I modified OLEGuids.tlb and VTableHandle.bas once again. (VTableHandle.bas is now x64 aware)
All LPSTR and LPWSTR got replaced to LONG StrPtr() so that the VB6 code base will be the same when transition to twinBASIC. (x86 or x64)
In x64 we cannot re-compile OLEGuids.odl as MIDL does not allow it. So it must be done via twinBASIC Package (OLEGuids.twin) which works great but does not support LPSTR and LPWSTR.. That's why it needed to be replaced to LONG in OLEGuids.tlb that in twinBASIC we can define LongPtr in the OLEGuids.twin package.
Sorry for the inconvenience caused.
Update released.
Fixed const FR_HIDEMATCHCASE from &H8000 into &H8000&.
Thanks to NBechtloff who made it possible to modify the type lib in VBCCR17.OCX so it could be re-compiled with "binary compatibility".
@Krool
The ComboBoxW does have a BackColor & ForeColor property to change the text display of the dropdown list but the ImageCombo control doesnt have them.
Have you forgotten to add these properties or is there another reason why they dont exist?
Do you have any idea how to change the BackColor & ForeColor property of the ImageCombo control?
You can't change them in ImageCombo.
The ImageCombo is basically a super-classed ComboBox.
The items are owner-drawn by MS and they hard-coded the fore color and background color.
So I guess through hacks and API redirection it's possible but that should be done by the app and not by a OCX.
At one machine I get this error:
VBCCR17:
Run-time error -2147221164 (80040154)
What could that be?
Any idea how to solve this?
This occurs in the _Initialize routine of an user control, with VBCCR17.LabelWs, VBCCR17.CommandButtonWs and one VBCCR17.TreeView, VB.Images
@Chris_G33
Search this thread for "-2147221164" and you will see i had the same problem with the older version of VBCCR1.6.
I used the OCX with SxS (Side-by-Side) but i had to manually registering the OCX on the system to fix this error.
@Krool
Im working on a Dark Mode for the VBCCR controls, see https://www.vbforums.com/showthread....e-amp-VB6-apps
The themed CheckBox and the Option control doesnt support the change of the forecolor so i started to ownerdraw the controls.
Currently i draw the checkbox symbol themed and the text with the control forecolor.
However, I have a problem with hottracking (moving the mouse over the checkbox) because this does not trigger the OwnerDraw event and therefore the checkbox cannot be drawn with CBS_UNCHECKEDHOT/CBS_CHECKEDHOT.
Can you change this and trigger the OwnerDraw event when a mouse hottracking occurs?
Another general problem with owner draw controls is that they are invisible in the IDE and you lose track of the controls on a form. Could this be changed somehow so that the owner draw controls are still displayed normally in the IDE?
IDE:
Attachment 188269
Started App:
Attachment 188270
Dark Mode:
Attachment 188271
@Krool
MS doesnt send the state ODS_HOTLIGHT when the mouse enters, moves or leaves the control.
A solution is to trigger the ownerdraw event at the current existing events "MouseEnter" and MouseLeave" to redraw the checkbox with CBS_UNCHECKEDHOT/CBS_CHECKEDHOT and the option control with RBS_UNCHECKEDHOT/RBS_CHECKEDHOT.
Please can you add this with the next update for the checkbox and optionbutton control?
Attachment 188313Attachment 188314
Attachment 188315Attachment 188316
Sorry, .Refresh within MouseEnter/MouseLeave doesnt trigger the OwnerDraw event and i guess it would not set the state to ODS_HOTLIGHT to draw the highlighted checkbox.
A solution would be to extend the OwnerDraw event parameters with "byval MouseEnter as boolean = false" and "byval MouseLeave as boolean = false" to simulate the control state ODS_HOTLIGHT. You could trigger the OwnerDraw event after "RaiseEvent MouseEnter" and "RaiseEvent MouseLeave" in the code. But im not sure how you get the necessary information for the other OwnerDraw event parameters at this point...
We don't need WM_DRAWITEM to include ODS_HOTLIGHT.
Since I already have a "MouseOver" state I could simply add that state when passing to the OwnerDraw event.
What I don't understand is your point that a .Refresh upon MouseEnter will not trigger an OwnerDraw.
Anyway, I could add an invalidation on that one automatically in the step when adding ODS_HOTLIGHT also.
Give me little bit time until it's added.
If we only use "MouseOver" and the user moves the mouse pointer outside the control how can the control be updated and redrawn with the normal checkbox?
Using "MouseEnter" will ensure to draw the "hot-checkbox" and MouseLeave will ensure to draw the normal checkbox again.
My code:
a .Refresh doesnt call the OwnerDraw sub.Code:Private Sub chkOwnerdraw_MouseEnter()
chkOwnerdraw.Refresh
End Sub
Private Sub chkOwnerdraw_MouseLeave()
chkOwnerdraw.Refresh
End Sub
Private Sub chkOwnerdraw_OwnerDraw(ByVal Action As Long, ByVal State As Long, ByVal hDC As Long, ByVal Left As Long, ByVal Top As Long, ByVal Right As Long, ByVal Bottom As Long)
Call OwnerDraw_CheckBox(chkOwnerdraw, Action, State, hDC, Left, Top, Right, Bottom)
End Sub