removed
I can't reproduce that. Please provide more details.
Printable View
Is there anything dangerous/wrong with the VTable subclass approach?
(I ask because now I'm sticking to the older version that use that technique)
Thank you for the tip, in case I decide to use the latest version.
What are the IOleControl features, something related to navigating with arrow keys?
When clicking the "Rich TextBox demo" button, it loads RichTextBoxForm and at the end of the Form_Load it is the line:
since RichTextBox1.SelFontName is not null, it tries to set "MS Sans Serif" to FontCombo1.Text, but FontCombo control's property Text is read-only. Hence it raises the error at the line:Code:If Not IsNull(RichTextBox1.SelFontName) Then FontCombo1.Text = RichTextBox1.SelFontName
Code:Err.Raise Number:=383, Description:="Property is read-only"
Hi All,
I am trying to extract icons from DLL file and add them to ImageList and then show them in ListView. The code is as follows:
It works...randomly - sometimes I have all the icons, sometimes not; after a listview refresh, sometimes they disappear; after a few refreshes, they come back again eventually. Picture1 always receives the icon, no matter if it's from the function or from the ImageList.Code:ListView1.ListItems.Clear
ImageList1.ListImages.Clear
ImageList1.ImageHeight = 32
ImageList1.ImageWidth = 32
ImageList1.ColorDepth = ImlColorDepth24Bit
For i = 0 To UBound(arrSomething)
Picture1.Cls
Picture1.Picture = GetIconFromFile(arrSomething(i).IconPath, True) ' Yep, the extracted icon is correct
ImageList1.ListImages.Add i+1 , , GetIconFromFile(arrSomething(i).IconPath, True) '<- this function return large icon as StdPicture
' ImageList1.ListImages.Add i+1 , , Picture1.Picture ' Just for testing - works but randomly
' Picture1.Picture = ImageList1.ListImages(i + 1).ExtractIcon ' This works always
With ListView1.ListItems.Add(, , arrSomething(i).Name, i+1)
....
End With
Next i
Am I doing something wrong or it's a bug in the ListView?!
Thank you.
Update released.
Improvement (cosmetic, not a bug) in VTableHandle.bas so that IOleControl do not disturb anymore in IDE on debugging.
Setting breakpoints (F9, F8 etc.). This cosmetic issue only affected the Std-EXE version and NOT the OCX.
You know what? This issue is resolved. :) It was easier than I thought and pretty straight forward solution.
So, there is nothing issue for you to update everything to the latest version.
I described this in post #2472
Just ignore the tip, as it's resolved. I deleted the tip to avoid confusion.
In fact the FontCombo.Text is not always read-only. It's only when there is no match in the list.
This behavior is the same as in the VB.ComboBox.
Here is a portion of the Text property in FontCombo:
As you see, it's only read-only when CB_FINDSTRINGEXACT returns CB_ERR. So in other words, "MS Sans Serif" is missing in your FontCombo1 list.Code:Case FtcStyleDropDownList
If FontComboHandle <> 0 And FontComboDesignMode = False Then
Dim Index As Long
Index = SendMessage(FontComboHandle, CB_FINDSTRINGEXACT, -1, ByVal StrPtr(Value))
If Not Index = CB_ERR Then
Me.ListIndex = Index
Else
Err.Raise Number:=383, Description:="Property is read-only"
End If
Else
Exit Property
End If
I don't have the issue because in my FontCombo1 "MS Sans Serif" is contained.
Can you please check which fonts are in your list and if "MS Sans Serif" is missing?
Great!, thank you very much Krool :thumb:
MS Sans Serif is not on the list of the FontCombo control, but it is on the font list of other programs such as Notepad.
I'll try to investigate the code to find the cause why it is skipped, but I'll do it later.
I'll update this post then. (*)
(I think that font is a type of font that is not vector based, that might be the cause -just a guess-)
* Update: I found that the cause was that I have Windows configured as the language for non Unicode programs to Hebrew (because I'm working with some right-to-left issues in my program).
As soon as I changed the Language back to Spanish, the MS Sans Serif font got listed on the control.
Studing the code, I found that while Windows is configured to display Hebrew, the EnumFontFamiliesEx API does not list the MS Sans Serif font. But other programs list it and it is available on the system.
It turned out my issue was with 32-bit pictures. VBCCR16 was failing with runtime error 50003 when I tried to open the form, but when I tried to load 32-bit images in a clean project, I got an "invalid picture format" error. Not a big deal; I don't need XP to work anyhow.
krool,nice job,I am trying to get Msgbox text,But get null,thank you!
Private Sub CommandButtonW1_Click()
kkk
End Sub
Private Function kkk() As Long
Dim Result As Long
Dim strErrMsg As String
Dim intOldMousePointer As Long
On Error GoTo errHandler
intOldMousePointer = Screen.MousePointer
Screen.MousePointer = vbHourglass
Result = -1
If Result = -1 Then
Err.Description = "this is test"
GoTo errHandler:
End If
errHandler:
Screen.MousePointer = intOldMousePointer
strErrMsg = Err.Description
On Error Resume Next
MsgBox strErrMsg
End Function
You raise an error by calling err.raise and specifying the error number.
Nothing to do with Krools Common Controls
thanks Arnoutdv
add code: debug.print strErrMsg,the strErrMsg is null(use vbcc CommandButtonW)
add code: debug.print strErrMsg,the strErrMsg is "this is test"(use vb CommandButton)
I get the reason,"Screen.MousePointer = intOldMousePointer",it created some mouse messages,and WindowProcControl received the mouse messages。I have solved the problem(use SetCapture、ReleaseCapture)。
Hi Krool
Please how to change the Statusbar Backcolor property ?
Hi Eduardo
Yes this works but the SizeGrip Backcolor remain unchanged !
If you need only the SizeGrip and not the whole StatusBar, you can use this control.
Krool,
a little difference between ComboBoxW and the standard control: you can not perform ".Additem vbNullString", it raises a strange error.
It's not a problem, to solve it is enough to use an empty string (""), I just want to let you know.
Like Eduardo suggested. You can use a special "SizeGrip UserControl".
I also posted a SizeGrip control here in the forum long time ago which draws on comctl32.dll (either themed or not, depending on manifest) and contrary to Eduardo's solution does not depend on static images.
My control was updated now to include a BackColor property. (SizeGrip; see link above)
Good point. I was not aware that CB_ADDSTRING or CB_INSERTSTRING returns CB_ERR when the string pointer is 0..
However, I added following check now inside the AddItem method to avoid such a situation in the ComboBoxW. (update released)
Code:Public Sub AddItem(ByVal Item As String, Optional ByVal Index As Variant)
[...]
If StrPtr(Item) = 0 Then Item = ""
Hi Krool ,
1- In previous posts here , there was a discussion about who is responsible for calling the SetupVisualStyles method and you said that it is the EXE`s responsibility not the ocx . But there is a question here , What about the controls created at runtime ? . I the have to recall the sub again after loading them . This seems normal in simple cases (low repetitive calls , not many controls , the loaded controls are in a form .. etc) . But there are some other cases where calling this method is tricky and overhead like if there are too many controls(loaded in runtime) or when calling this sub for many times depending on the control load logic and behavior in the code and also when these newly created controls are in a nested user control or non-nested one . All the previous cases have a workaround and can be done . But just a thought if it can be handled or being re-thought about this case .
2- In Dtpicker , while formatted for time and the digits are displayed in Arabic with SegeoUI font , the hours panel is not fully displayed . When the hours are represented in two digits like 12 or 13 etc , the digit 1 is not at all visible . If for example the hour is 23 , the digit 2 is partially visible and so on .This happens only in digits in Arabic format . So , The area for the hours panel is not drawing correctly in this case .
3- About TextBoxW Balloon Tips , It only shows the balloon for the last textbox . Can this be solved ? . I know this is because it should hide when the text box loses the focus and this is the case when showing these tips .
If it can be handled without changing focus or capture state it will be nice because it also has some disadvantages . The first one is mentioned above : is that the they can not be shown simultinously .And also , they force the text box to fire both LostFocus and GotFocus events too many times which adds overhead especially when these events contain some code (Like in my case) .
I used debug.print in both LostFocus and GotFocus events for the TextBox when showing the balloon tip and the result was as following :
exit
enter
enter
exit
enter
exit
Besides overhead , There is something which is more dangerous that is firing SetFocus event two times one after another which can not happen in normal behavior. Most of code that is placed in gotfocus event is sometimes related to lostfocus event as it is always expected that when gotfocus event is fired , it will never be fired again until it loses the focus .This double call caused a lot of problems in my case and I have just figured out the reason . So , If it is possible for balloon tips to implemented without dealing with setting and releasing the capture , it will add many advantages (Showing many ones at the same time - reducing overhead - solving the double calls for set capture - saving performance by eliminating multiple calls for LostFocus and GotFocus events too many times ) .
Thanks a lot for you effort .
Is anyone else experiencing the problem that text inside TextBoxW with alignment set to vbCenter does not get centered?
Attachment 174555Code:TextBoxW1.Text = "this should be centered"
TextBoxW1.Alignment = vbCenter
Works for me in Windows 10. Checked running in the IDE and design mode with the OCX version.
Windows XP, Home Edition, SP3, version 2002.
Using VBCCR16.OCX 1.06.0061 3af959d
Update released.
I noticed in a new form-less application that CommonDialog.ShowPrinterEx was not working and raised the error "The PrintDlgEx function failed during initialization." with the error value E_HANDLE.
The CommonDialog.ShowPrinter was not affected.
It turns out that the PrintDlg API can deal without owner window whereas on PrintDlgEx the owner window member value cannot be NULL. It returns E_HANDLE when it's NULL.
The internal function to get the owner window in CommonDialog is as following:
So in a form-less application GetOwnerWindow() is NULL.Code:Private Function GetOwnerWindow() As Long
Dim hWnd As Long, hWndMDIClient As Long
hWnd = GetActiveWindow()
If hWnd <> 0 Then hWndMDIClient = FindWindowEx(hWnd, 0, StrPtr("MDIClient"), 0)
If hWndMDIClient <> 0 Then
Const WM_MDIGETACTIVE As Long = &H229
GetOwnerWindow = SendMessage(hWndMDIClient, WM_MDIGETACTIVE, 0, ByVal 0&)
Else
GetOwnerWindow = hWnd
End If
End Function
As the other common dialog boxes accepts a NULL value and only PrintDlgEx being an exception I keep GetOwnerWindow() unchanged and do a workaround in the ShowPrinterEx function only, as following: (code in blue is new, added)
Also, which I was not aware of, is that .ShowPrinter (PrintDlg) looks different in a form-less app than in a normal form app. (difference being owner window NULL or not)Code:.hWndOwner = GetOwnerWindow()
If .hWndOwner = 0 Then
' According to MSDN:
' This member must be a valid window handle; it cannot be NULL.
' The PrintDlgEx function will return E_HANDLE when this member was NULL.
.hWndOwner = GetDesktopWindow()
End If
PrintDlg (Valid owner window)
Attachment 174583
PrintDlg (Owner window NULL)
Attachment 174581
hi Krool
Whether next version can support the following
http://www.vbforums.com/showthread.p...oplist-problem
Krool,
I too have a request. Hopefully it isn't too much work. VB6 provides a horizontal and vertical scrollbar for dropping onto your form, however, they don't seem to respond to mouse scroll wheel movement natively.
My form has your treeview and slider controls, both of which respond to mouse scrollwheel movement (a quick aside - when the treeview's contents extend in x/y beyond the control's boundaries, your treeview only responds to vertical scrolls even when the horizontal scrollwheel has the focus, same as .NET). Regardless of any perceived inconsistency there, that is all well and good for me. I am very impressed by the treeview control.
My form also uses the VB6 native file listbox which strangely already responds to mouse scrollwheel events. Even better.
https://i.imgur.com/sW0Bexf.png
The trouble is that I also have a pseudo-thumbnail view and use both a horizontal and vertical scroll bar, one to navigate through my icons in that thumbnail view and the other horizontal one, to scroll an icon map. Neither of these two standard VB6 scrollbars respond to mouse scroll wheel movement and as a result these controls are inconsistent with the rest of the form.
https://i.imgur.com/mZiNCSz.png
My VB.NET version, of course handles all mouse scroll wheel movements as the user would expect but I prefer the VB6 version and I want it to operate as well as the VB.NET does.
So, my request is: Can you please create the vertical/horizontal scrollbar controls and add them to your collection? I think it would be a useful addition, certainly for me.
We could call them SKroolbars...
How about updating Horizontal Scrollbar via MouseWheel when Kybd Shift is pressed.Quote:
your treeview only responds to vertical scrolls even when the horizontal scrollwheel has the focus, same as .NET).
That is how it works on Web Scrollbars.
See ucScrollbar control where Kybd Shift has been implemented for Horizontal Scrollbar.
http://www.vbforums.com/showthread.p...=1#post5437197
I could do that but I prefer scrollbars to operate as they should and just as they do in other apps and also how they operate in the .NET version of the same application.
Also, bearing in mind what I said in my request, that the other scrollbars are all functioning just as they ought. It is just these two native scrollbars that do not. It would be logically more sensible to fix the two bars that aren't functioning as expected, rather than have to work on all those that are working correctly in order to make them operate differently and counter-intuitively to most user expectations.
Hello Krool, I want to ask you what is the purpose of your MsgBox overwrite function:
Thank you.Code:' (VB-Overwrite)
Public Function MsgBox(ByVal Prompt As String, Optional ByVal Buttons As VbMsgBoxStyle = vbOKOnly, Optional ByVal Title As String) As VbMsgBoxResult
It is Unicode.
If you sort your controls alphanumeric in the Vbp file they will appear sorted in the ToolBox.
Actually, I usually sort the entire block containing Modules/Classes/Controls/PropertyPages to make the Vbp more readable.
Is it possible to make a list (listview?) where a row spans multiple lines, possibly using different formatting for some elements?
An example:
Attachment 174629
Note that the second row is selected, and the name is in bold.
this is where ownerdraw come into play
on the listbox (and some other controls) there is a DrawMode property and corresponding events.
although I can not see these on the listview control, maybe krool will decide to add it at some point.
you could still use the windows api to do it
Replacing the intrinsic VB functions form the OCX would be possible using ASM code.
Last time I tried it the sample wouldn't load. I don't think they are really trying to make something people can use. Just tech types having fun I think.
I don't think you are correct there old chum. You may need some guidance on getting it to work for you but your current attitude is akin to going to the doctor once and saying, "I tried some medicine once and it didn't work. I don't think they are really trying to make people better. Just medico types trying to look important I think."
The demo still doesn't run. Not saying it's impossible to get it to run. But normally you run a demo - it doesn't work - you give up and move on. I asked about it, googled, tried a few things - more than most people would ever bother doing - and it still doesn't run. So for sure it's a terrible demo that makes the entire project look bad. And it's still in the first link here. If people are serious about a project they make sure the demo works. If they are just tech types having fun then they don't care. I get the feeling that's the case here.
I'll show you what people see when they run this project...
Attachment 174649
I think I found the problem here:
Attachment 174647
So you do some digging, find the missing file (it's actually hidden inside the demo if you know where to look)... you fix that problem and you are still no further ahead because of THIS issue...
Attachment 174651
Long before this point most people would just give up. As I said.. not really a criticism... just an observation. But this isn't a project where the author is trying to make something useful for most VB programmers. He's having fun doing something he enjoys. Great for him. Unfortunately a potentially great and useful project is ruined by a non functional demo.
Out of curiosity.. what the heck is "a manifest specifying comctl32.dll version 6.0 or higher" and where would a person get one?
I found the VBCCR OCX in another thread and registered it and loaded it up to test. Some of the controls do work but about half of them say something like:
"The linkLabel control requires at least version 6.0 of comctl32.dll".
I have the version from SP6 so shouldn't it be the right version? And isn't the entire point of this project to get away from comctl32?
Attachment 174653
And then the project wants me to make a manifest for VB6... * sigh * Time to give up again. But as I said last time, it's an interesting project. Hopefully some day somebody can get the demo to work right.
It's modern nowadays to give up immediately on first problems instead to read the notes or make some research?
If youwould read the notes in the first thread you would know to make following setting;
Goto menu Tools -> Options... -> General -> Error Trapping.
"Break on Unhandled Errors" should be selected instead of "Break in Class Module".
This is some odd default setting of VB6 whichI can't do something about. However, it's s one-time change in settings and then OK for the end of life of that installation.
Now the demo runs.
About the rest make some google research about manifesting and theming.
It's optional, when you don't want full features you not need to manifest. It's not my restriction. It's windows.
comctl32.dll is a windows system file, and not an MS OCX. The .dll is part of the core and always pre-installed.
Please don't post such statements with "half knowledge".
If it's too overwhelming for you just move on.
It's the responsibility of the >>EXE<< to make such things. It would be ridicolous if an OCX overwrites VB functions without any control and with ASM hacks..
Well... that did change things. Now the whole IDE just closes and exits without any error message. But the demo still doesn't run.
Just to make sure it wasn't just this new laptop I'm having troubles with I downloaded the demo and ran it on another computer. Identical result. Press Run and * poof * the IDE closes and exits. No error message. Just gone.
Best of luck on what looks like a very powerful project with a lot of potential. I'll be sure to keep an eye on this thread and see what happens in future.