Page 82 of 83 FirstFirst ... 32727980818283 LastLast
Results 3,241 to 3,280 of 3288

Thread: CommonControls (Replacement of the MS common controls)

  1. #3241

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,925

    Re: CommonControls (Replacement of the MS common controls)

    I could have implemented in last update.. However, if I would implement anytime soon (maybe with something other so it would be worth to upgrade type lib version) then as following:

    Code:
    Public Function GetTextRange(ByVal Min As Long, ByVal Max As Long) As String
    If Min > Max Then Err.Raise 380
    If RichTextBoxHandle <> 0 Then
        Dim RETR As RETEXTRANGE, Buffer As String, Length As Long
        RETR.CharRange.Min = Min
        RETR.CharRange.Max = Max
        Buffer = String$(RETR.CharRange.Max - RETR.CharRange.Min + 1, vbNullChar)
        RETR.lpstrText = StrPtr(Buffer)
        Length = SendMessage(RichTextBoxHandle, EM_GETTEXTRANGE, 0, ByVal VarPtr(RETR))
        If Length > 0 Then GetTextRange = Left$(Buffer, Length)
    End If
    End Function
    Code:
    Private Type RECHARRANGE
    Min As Long
    Max As Long
    End Type
    Private Type RETEXTRANGE
    CharRange As RECHARRANGE
    lpstrText As Long
    End Type
    Private Const EM_GETTEXTRANGE as Long = (WM_USER + 75)
    EDIT: some other implemented above function not with Min and Max but rather with Start and Length (similar to SelStart and SelLength), so Min = Start and Max = Start + Length
    Last edited by Krool; Oct 15th, 2021 at 12:35 AM.

  2. #3242
    Addicted Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    203

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    Buffer = String$(RETR.CharRange.Max - RETR.CharRange.Min + 1, vbNullChar)
    Does this calculation of the length also work if the address contains unicode characters?

  3. #3243

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,925

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Mith View Post
    Does this calculation of the length also work if the address contains unicode characters?
    The buffer is unicode. So yes.

  4. #3244
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    6,698

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by vbLewis View Post
    just curious... Is that return text a C string or a com allocated string? wondering if sysallocatestring should be used on it?
    According to the documentation, this is what the TEXTRANGE structure looks like for wide strings.
    Code:
    typedef struct _textrangew {
      CHARRANGE chrg;
      LPWSTR    lpstrText;
    } TEXTRANGEW;
    Mith used SendMessageW which would would treat strings as wide strings so the above structure should be assumed. Notice the lpstrText member. It's defined as LPWSTR which means it's a pointer to a wide string. A wide string in this case would be a UTF-16 String. A VB6 String is also a UTF-16 format string but not an LPWSTR. It's a BSTR. They are kind of the same but not the same. Nonetheless what he did in code is may be correct. He defined the lpstrText as a String in VB6 and allocated space for it to be written to by SendMessageW. My only concern with that code is any potential ANSI conversion of the String before and after by VB6 when SendMessageW is called. But based on your response the code works.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell

    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

  5. #3245
    Member
    Join Date
    Oct 2007
    Posts
    50

    Re: CommonControls (Replacement of the MS common controls)

    Hi Krool,
    So I have been using RTB from previous update and I have been experiencing RTL issues.
    Consider a command button with this code:
    RichTextBox1.RightToLeftMode = CCRightToLeftModeNoControl
    RichTextBox1.RightToLeft = True
    RichTextBox1.RightToLeftMode = CCRightToLeftModeVBAME
    RichTextBox1.Enabled = False
    RichTextBox1.Enabled = True
    RichTextBox1.Text = "ABC"

    The enabled false/true thing I have discovered is needed to get the RTB to 'work' for a few other things too (incl update scrollbars). Setting the RTL modes like that was also the only way I could get it to work.

    Anyway, on Win7, this works where the text moves to the right margin for RTL for both MSFTEDIT and RichEdit 3.1 controls.
    On Win 10/11, it does NOT work for the MSFTEDIT control, but DOES if I tell the RTB to only use the RichEdit 3.1 control.

    I isolated that it DOES work correctly UNTIL you set the text property. I can type and it will appear on the right margin, but as soon as I set that text property it loses it.

    So I came here to post about it and I see you issued a new update where you changed the text in/out to use a different method than before to fix the CRLF stuff. I was hopeful that would fix it, but when I just tried it on the same Win7 machine that worked previously, it now will not work either where the same problem occurs as on Win 10 (the old version does work for this on my Win7).

    How do I get the RTB to show assigned RTL text on the right side of the screen? What am I missing here?

    Thanks!

  6. #3246

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,925

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by chrislong2 View Post
    Hi Krool,
    So I have been using RTB from previous update and I have been experiencing RTL issues.
    Consider a command button with this code:
    RichTextBox1.RightToLeftMode = CCRightToLeftModeNoControl
    RichTextBox1.RightToLeft = True
    RichTextBox1.RightToLeftMode = CCRightToLeftModeVBAME
    RichTextBox1.Enabled = False
    RichTextBox1.Enabled = True
    RichTextBox1.Text = "ABC"

    The enabled false/true thing I have discovered is needed to get the RTB to 'work' for a few other things too (incl update scrollbars). Setting the RTL modes like that was also the only way I could get it to work.

    Anyway, on Win7, this works where the text moves to the right margin for RTL for both MSFTEDIT and RichEdit 3.1 controls.
    On Win 10/11, it does NOT work for the MSFTEDIT control, but DOES if I tell the RTB to only use the RichEdit 3.1 control.

    I isolated that it DOES work correctly UNTIL you set the text property. I can type and it will appear on the right margin, but as soon as I set that text property it loses it.

    So I came here to post about it and I see you issued a new update where you changed the text in/out to use a different method than before to fix the CRLF stuff. I was hopeful that would fix it, but when I just tried it on the same Win7 machine that worked previously, it now will not work either where the same problem occurs as on Win 10 (the old version does work for this on my Win7).

    How do I get the RTB to show assigned RTL text on the right side of the screen? What am I missing here?

    Thanks!
    I cannot reproduce it.

    I have following code:
    Code:
    RichTextBox1.TextMode = RtfTextModePlainText
    RichTextBox1.RightToLeftMode = CCRightToLeftModeNoControl
    RichTextBox1.RightToLeft = True
    RichTextBox1.Text = "ABC"
    The text is right aligned and rtl reading is on.

    Edit: OS is win 10
    Last edited by Krool; Oct 16th, 2021 at 04:38 AM.

  7. #3247
    Lively Member
    Join Date
    Apr 2017
    Location
    India
    Posts
    105

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    Update released.

    Finally fixed the mismatch of the RichTextBox Text property concerning CrLf and the internal Cr only.
    The RichTextBox control now uses EM_GETTEXTEX/EM_SETTEXTEX instead of EM_STREAMOUT/EM_STREAMIN for the Text property.
    Included the UseCrLf property to control whether or not to apply GT_USECRLF/GTL_USECRLF on EM_GETTEXTEX.
    It defaults to False and thus makes a compatibility break to the previous VBCCR which used EM_STREAMOUT (always CrLf)

    Also included the TextLength property in the TextBoxW and RichTextBox control to conveniently get the length of text w/o the need of allocating memory for the Text. (like in .net)

    The OCX VBCCR17 was also updated. The internal type lib version is now 1.1.
    Code:
    Object={7020C36F-09FC-41FE-B822-CDE6FBB321EB}#1.1#0; VBCCR17.OCX
    Thanks a TON, once again, dear krool.
    Thank you very much for the UseCrLf property and also for making it default to False. I was waiting for this update like anything.
    I think I can now start thinking of using the OCX version of your controls.

    Kind regards.

  8. #3248
    Member
    Join Date
    Oct 2007
    Posts
    50

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    I cannot reproduce it.

    I have following code:
    Code:
    RichTextBox1.TextMode = RtfTextModePlainText
    RichTextBox1.RightToLeftMode = CCRightToLeftModeNoControl
    RichTextBox1.RightToLeft = True
    RichTextBox1.Text = "ABC"
    The text is right aligned and rtl reading is on.

    Edit: OS is win 10
    Thank you Krool! I was not setting the text mode to plain text even though I wasn't using it for RTF. I don't remember why I didn't set it, though I have noted that text assignment for larger Unicode files takes notably longer to load in the control with the previous version when the text mode is set. With the new methodology for text mode in the latest release, it's quicker than it was though still less than when mode is RTF. But perfectly fine. Anyway when it's not set and RTF mode is used, then the RTL stuff doesn't work right although it sometimes partially does (like I said, the previous release did somewhat on Win 7). But since I don't use RTF, I've just set the text mode with newer version and it is working just as you posted. Thanks for the response. I haven't yet tested the CRLF stuff (I had already worked around that) so I just enabled the new UseCRLF option so it would work right away with what I'd already done, but I appreciate you addressing that!! That was a major oddity with the RTF control and it affected lots of things where the numbers wouldn't match up. Thanks for your continued work with these controls.

    2 more things while I've got you:

    1) With the RTB control, I do wish you would reconsider changing that code in CreatePrintJob from:

    Code:
        .Left = LeftMargin - PhysOffsetCX
        .Top = TopMargin - PhysOffsetCY
        .Right = (PhysCX - RightMargin) + PhysOffsetCX
        .Bottom = (PhysCY - BottomMargin) + PhysOffsetCY
    to

    Code:
        If (LeftMargin - PhysOffsetCX) > 0 Then
            .Left = LeftMargin - PhysOffsetCX
        Else
            .Left = PhysOffsetCX
        End If
        If (RightMargin - PhysOffsetCX) > 0 Then
            .Right = (PhysCX - .Left) - (RightMargin - PhysOffsetCX)
        Else
            .Right = (PhysCX - .Left) - PhysOffsetCX
        End If
        If (TopMargin - PhysOffsetCY) > 0 Then
            .Top = TopMargin - PhysOffsetCY
        Else
            .Top = PhysOffsetCY
        End If
        If (BottomMargin - PhysOffsetCY) > 0 Then
            .Bottom = PhysCY - (BottomMargin - PhysOffsetCY)
        Else
            .Bottom = PhysCY - PhysOffsetCY
        End If
    I know it doesn't look as pretty, but your current code does not work correctly when the specified margins are less than the offsets (which can happen, particularly in apps where user is able to set the margins), so that means I have to replace this part of code when you release an update.

    2) For the Label control: When Auto Size and Word Wrap are enabled, if there are no spaces in a block of text (say a long spaceless path or something) then the text will not wrap and will just get cut off at the extreme edge of the form and the autosizing seems to extend beyond the form. If there is later text after that (say it's a caption that has such text but then also has a vbcrlf and then other text), then that text also will get cut off EVEN IF that text has spaces and could wrap correctly. It does this because the autosizing was set wrong because it was expanded out.

    Anyway, there is a simple fix for this, which is to force the word wrapping to wrap even if it can't do it on spaces. You simply use the DT_EDITCONTROL for it (Private Const DT_EDITCONTROL = &H2000&). So:

    Code:
    If PropWordWrap = True Then Format = Format Or DT_WORDBREAK Or DT_EDITCONTROL
    This isn't well documented, but when DT_EDITCONTROL is used with word wrapping, if word wrapping can't work because there's no spaces, then it will go ahead and force a wrap anyway. At least I've verified that's what it does on Win7+ (haven't checked earlier OS).

    I have run into this situation on 2 different projects using the Label control and have had to custom modify per the above to get it fixed.

    [edit: you may want to make this DT_EDITCONTROL be used only if a new property is set to true (maybe a ForceablyWrap setting). This way the current implementation of word wrapping (which I think does more accurately mirror what VB's internal label control does if my memory is correct) can still be as it is, but this 2nd way is an option. To me a forceable wrap is almost always the preferable approach to just blatantly cut off text.]

    [edit 2: I know there's the path elipsis options, but those are only really helpful if the text ONLY contains a path, not it might contain a path AND some other text, or just some other text that might not have spaces.]
    Last edited by chrislong2; Oct 19th, 2021 at 11:14 PM.

  9. #3249

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,925

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by chrislong2 View Post
    Thank you Krool! I was not setting the text mode to plain text even though I wasn't using it for RTF. I don't remember why I didn't set it, though I have noted that text assignment for larger Unicode files takes notably longer to load in the control with the previous version when the text mode is set. With the new methodology for text mode in the latest release, it's quicker than it was though still less than when mode is RTF. But perfectly fine. Anyway when it's not set and RTF mode is used, then the RTL stuff doesn't work right although it sometimes partially does (like I said, the previous release did somewhat on Win 7). But since I don't use RTF, I've just set the text mode with newer version and it is working just as you posted. Thanks for the response. I haven't yet tested the CRLF stuff (I had already worked around that) so I just enabled the new UseCRLF option so it would work right away with what I'd already done, but I appreciate you addressing that!! That was a major oddity with the RTF control and it affected lots of things where the numbers wouldn't match up. Thanks for your continued work with these controls.

    2 more things while I've got you:

    1) With the RTB control, I do wish you would reconsider changing that code in CreatePrintJob from:

    Code:
        .Left = LeftMargin - PhysOffsetCX
        .Top = TopMargin - PhysOffsetCY
        .Right = (PhysCX - RightMargin) + PhysOffsetCX
        .Bottom = (PhysCY - BottomMargin) + PhysOffsetCY
    to

    Code:
        If (LeftMargin - PhysOffsetCX) > 0 Then
            .Left = LeftMargin - PhysOffsetCX
        Else
            .Left = PhysOffsetCX
        End If
        If (RightMargin - PhysOffsetCX) > 0 Then
            .Right = (PhysCX - .Left) - (RightMargin - PhysOffsetCX)
        Else
            .Right = (PhysCX - .Left) - PhysOffsetCX
        End If
        If (TopMargin - PhysOffsetCY) > 0 Then
            .Top = TopMargin - PhysOffsetCY
        Else
            .Top = PhysOffsetCY
        End If
        If (BottomMargin - PhysOffsetCY) > 0 Then
            .Bottom = PhysCY - (BottomMargin - PhysOffsetCY)
        Else
            .Bottom = PhysCY - PhysOffsetCY
        End If
    I know it doesn't look as pretty, but your current code does not work correctly when the specified margins are less than the offsets (which can happen, particularly in apps where user is able to set the margins), so that means I have to replace this part of code when you release an update.

    2) For the Label control: When Auto Size and Word Wrap are enabled, if there are no spaces in a block of text (say a long spaceless path or something) then the text will not wrap and will just get cut off at the extreme edge of the form and the autosizing seems to extend beyond the form. If there is later text after that (say it's a caption that has such text but then also has a vbcrlf and then other text), then that text also will get cut off EVEN IF that text has spaces and could wrap correctly. It does this because the autosizing was set wrong because it was expanded out.

    Anyway, there is a simple fix for this, which is to force the word wrapping to wrap even if it can't do it on spaces. You simply use the DT_EDITCONTROL for it (Private Const DT_EDITCONTROL = &H2000&). So:

    Code:
    If PropWordWrap = True Then Format = Format Or DT_WORDBREAK Or DT_EDITCONTROL
    This isn't well documented, but when DT_EDITCONTROL is used with word wrapping, if word wrapping can't work because there's no spaces, then it will go ahead and force a wrap anyway. At least I've verified that's what it does on Win7+ (haven't checked earlier OS).

    I have run into this situation on 2 different projects using the Label control and have had to custom modify per the above to get it fixed.

    [edit: you may want to make this DT_EDITCONTROL be used only if a new property is set to true (maybe a ForceablyWrap setting). This way the current implementation of word wrapping (which I think does more accurately mirror what VB's internal label control does if my memory is correct) can still be as it is, but this 2nd way is an option. To me a forceable wrap is almost always the preferable approach to just blatantly cut off text.]

    [edit 2: I know there's the path elipsis options, but those are only really helpful if the text ONLY contains a path, not it might contain a path AND some other text, or just some other text that might not have spaces.]
    Can you share the RTF so I can play around and what maybe find the issue ? Maybe there is something RTF encoded which forces the alignment...

    Point 1:
    For Right/Bottom I add PhysOffsetCX/CY while you substract it. So this is something to clarify before I make the change..

    Point 2:
    I would certainly add an additional property for that DT_EDITCONTROL. I suggest the name 'MimicTextBox'.

  10. #3250
    Member
    Join Date
    Oct 2007
    Posts
    50

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    Can you share the RTF so I can play around and what maybe find the issue ? Maybe there is something RTF encoded which forces the alignment...

    Point 1:
    For Right/Bottom I add PhysOffsetCX/CY while you substract it. So this is something to clarify before I make the change..

    Point 2:
    I would certainly add an additional property for that DT_EDITCONTROL. I suggest the name 'MimicTextBox'.
    I didn't actually use it as RTF mode. I just never set the text mode to text only so it stayed on the default RTF mode. The text I was assigning to the box was straight text and didn't use RTF. That may have something to do with it. You can try out yourself by using your code on an RTB that does not have the text mode set to text only but is using the default RTF mode. When that is the case, the right to left stuff doesn't work (or only partially works, depending).

    Point 1: See my post #3225. You got that adding stuff from that Microsoft example, but it is not correct. I am highly confident having tried on a couple different printers (and having wasted a lot of paper lol), that the code I posted above is correct and theirs is wrong.

    Point 2: You can call it whatever you want. MimicTextBox or MimicTextBoxWrapping works. I like something about "force wrapping" because that's a tad clearer as to its actual effect. But yeah, basically it's mimicking a text box for wrapping.

  11. #3251

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,925

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by chrislong2 View Post
    I didn't actually use it as RTF mode. I just never set the text mode to text only so it stayed on the default RTF mode. The text I was assigning to the box was straight text and didn't use RTF. That may have something to do with it. You can try out yourself by using your code on an RTB that does not have the text mode set to text only but is using the default RTF mode. When that is the case, the right to left stuff doesn't work (or only partially works, depending).
    There is a \rtlpar overriding the WS_EX_RIGHT style bit. So, that's why it is only working to change at run-time in plain text mode.

  12. #3252

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,925

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by chrislong2 View Post
    I didn't actually use it as RTF mode. I just never set the text mode to text only so it stayed on the default RTF mode. The text I was assigning to the box was straight text and didn't use RTF. That may have something to do with it. You can try out yourself by using your code on an RTB that does not have the text mode set to text only but is using the default RTF mode. When that is the case, the right to left stuff doesn't work (or only partially works, depending).
    Fixed now. Thanks

    I am confused about your proposed new calculations..

    For Right you make .Right = (PhysCX - .Left) - (RightMargin - PhysOffsetCX)
    but for Bottom you make .Bottom = PhysCY - (BottomMargin - PhysOffsetCY)
    Why do you deduct .Left for Right and by Bottom you do not deduct .Top ?

    Code:
        If (LeftMargin - PhysOffsetCX) > 0 Then
            .Left = LeftMargin - PhysOffsetCX
        Else
            .Left = PhysOffsetCX
        End If
        If (RightMargin - PhysOffsetCX) > 0 Then
            .Right = (PhysCX - .Left) - (RightMargin - PhysOffsetCX)
        Else
            .Right = (PhysCX - .Left) - PhysOffsetCX
        End If
        If (TopMargin - PhysOffsetCY) > 0 Then
            .Top = TopMargin - PhysOffsetCY
        Else
            .Top = PhysOffsetCY
        End If
        If (BottomMargin - PhysOffsetCY) > 0 Then
            .Bottom = PhysCY - (BottomMargin - PhysOffsetCY)
        Else
            .Bottom = PhysCY - PhysOffsetCY
        End If
    Last edited by Krool; Oct 22nd, 2021 at 01:38 PM.

  13. #3253
    Member
    Join Date
    Oct 2007
    Posts
    50

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    Fixed now. Thanks

    I am confused about your proposed new calculations..

    For Right you make .Right = (PhysCX - .Left) - (RightMargin - PhysOffsetCX)
    but for Bottom you make .Bottom = PhysCY - (BottomMargin - PhysOffsetCY)
    Why do you deduct .Left for Right and by Bottom you do not deduct .Top ?
    Because I messed up in what I posted. lol So sorry! When I was copying/pasting, I copied the code from the wrong place and mistakenly copied code I was "working on" trying a few months ago. It should be this:

    Code:
        If (LeftMargin - PhysOffsetCX) > 0 Then
            .Left = LeftMargin - PhysOffsetCX
        Else
            .Left = PhysOffsetCX
        End If
        If (TopMargin - PhysOffsetCY) > 0 Then
            .Top = TopMargin - PhysOffsetCY
        Else
            .Top = PhysOffsetCY
        End If
        .Right = (PhysCX - RightMargin) - PhysOffsetCX
        .Bottom = (PhysCY - BottomMargin) - PhysOffsetCY
    This also matches the behavior of basically what I've been using for 20+ years with the old RTB.

  14. #3254
    Lively Member
    Join Date
    Oct 2016
    Posts
    78

    Re: CommonControls (Replacement of the MS common controls)

    HI!
    I have a very interesting question. why don't the tabstrip Tabs have an Enabled and Visible Property.

    I have never needed it, but today i wanted to use it, only to realize it doesn't exist

    I see that the Microsoft tabstrip also doesn't have it, it would be a nice feature to add.

    thanks

  15. #3255

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,925

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Semke View Post
    HI!
    I have a very interesting question. why don't the tabstrip Tabs have an Enabled and Visible Property.

    I have never needed it, but today i wanted to use it, only to realize it doesn't exist

    I see that the Microsoft tabstrip also doesn't have it, it would be a nice feature to add.

    thanks
    There is no tab control item state available to visually disable a tab item.
    However, you may cancel out on TabBeforeClick event.

    For Visible. Hmm, then just don't add a tab item.
    Again, also no state for that.

  16. #3256
    Addicted Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    203

    Win10: runtime error -2147221164 (80040154) class not registered

    VBCCR v1.7.27

    my vb6-app uses the vbccr17.ocx side-by-side without registering the OCX on the windows system.

    Now one of my users got a error message when starting my app under Win10 21H1 (Build 19043.1319):

    Name:  image001.png
Views: 344
Size:  4.1 KB

    translated: "runtime error -2147221164 (80040154) class not registered"

    Does someone have any experience with this error message and maybe a solution how to fix that problem?

    I tried to reproduce this problem but at my Win10-PC everything runs fine...

  17. #3257
    Addicted Member
    Join Date
    Feb 2015
    Location
    Colorado USA
    Posts
    201

    Re: Win10: runtime error -2147221164 (80040154) class not registered

    I found that the new OCX version of Krools's controls caused a bit of a hiccup the other day. Normally, as long as the new VBCCRxx.OCX is in the same version number (1.7 for now), all you have to do is copy the latest one over the older one. But with the version 1.7.32 which came out this past Monday, I couldn't get it to work in VB6 without re-registering it with regsvr32. There must have been something in the new version that caused a minor incompatibility with the previous versions. Once I re-registered it then I had no problems. BTW, he came out with v1.7.34 on the 26th (3 days ago) and when I used the OCX version to overwrite the 1.7.32 version everything worked just fine.

    So the bottom line is that something changed between OCX versions 1.7.30 and 1.7.32 and later that caused me to have to re-register the OCX file one time.

  18. #3258

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,925

    Re: Win10: runtime error -2147221164 (80040154) class not registered

    Quote Originally Posted by MountainMan View Post
    I found that the new OCX version of Krools's controls caused a bit of a hiccup the other day. Normally, as long as the new VBCCRxx.OCX is in the same version number (1.7 for now), all you have to do is copy the latest one over the older one. But with the version 1.7.32 which came out this past Monday, I couldn't get it to work in VB6 without re-registering it with regsvr32. There must have been something in the new version that caused a minor incompatibility with the previous versions. Once I re-registered it then I had no problems. BTW, he came out with v1.7.34 on the 26th (3 days ago) and when I used the OCX version to overwrite the 1.7.32 version everything worked just fine.

    So the bottom line is that something changed between OCX versions 1.7.30 and 1.7.32 and later that caused me to have to re-register the OCX file one time.
    Yes. Typelib change from 1.0 to 1.1. (due to RichTextBox)
    I think if minor version changes it's compatible.

  19. #3259
    Addicted Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    203

    Re: Win10: runtime error -2147221164 (80040154) class not registered

    i use VBCCR version 1.7.27 and i dont register the OCX on the windows system because i use SxS (side-by-side).
    The manifest is included in the RES file.
    Why i have to register the OCX on the system if i use SxS?

  20. #3260
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    4,783

    Re: CommonControls (Replacement of the MS common controls)

    If you use SxS then you have to recreate your manifest file.

  21. #3261
    Addicted Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    203

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Arnoutdv View Post
    If you use SxS then you have to recreate your manifest file.
    Why should i recreate my manifest file? The manifest file (compiled in the RES) is ok because the app starts without any problems from Win7 to Win11 on all my test systems.

    Currently only one user get this "strange" error message about registering the OCX when starting the app under win10...
    Registering an OCX when using SxS??

  22. #3262
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    4,783

    Re: CommonControls (Replacement of the MS common controls)

    No, it’s not fine, otherwise you shouldn’t get the vbCCR ActiveX message.

  23. #3263
    Addicted Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    203

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Arnoutdv View Post
    No, it’s not fine, otherwise you shouldn’t get the vbCCR ActiveX message.
    Maybe you not read what i wrote before: the app runs without any OCX error messages from win7 to win11.
    For example: 999 of 1000 users have no problems running the app! Only one user get this error message.
    How is this possible if the manifest is not ok? Can you explain this?

  24. #3264

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,925

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Mith View Post
    Maybe you not read what i wrote before: the app runs without any OCX error messages from win7 to win11.
    For example: 999 of 1000 users have no problems running the app! Only one user get this error message.
    How is this possible if the manifest is not ok? Can you explain this?
    My stomage says the VB.PropertyBag is corrupt at the registry of that 1 user.

  25. #3265
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    4,783

    Re: Win10: runtime error -2147221164 (80040154) class not registered

    Quote Originally Posted by MountainMan View Post
    I found that the new OCX version of Krools's controls caused a bit of a hiccup the other day. Normally, as long as the new VBCCRxx.OCX is in the same version number (1.7 for now), all you have to do is copy the latest one over the older one. But with the version 1.7.32 which came out this past Monday, I couldn't get it to work in VB6 without re-registering it with regsvr32. There must have been something in the new version that caused a minor incompatibility with the previous versions. Once I re-registered it then I had no problems. BTW, he came out with v1.7.34 on the 26th (3 days ago) and when I used the OCX version to overwrite the 1.7.32 version everything worked just fine.

    So the bottom line is that something changed between OCX versions 1.7.30 and 1.7.32 and later that caused me to have to re-register the OCX file one time.
    This is the reason why I mentioned generating the manifest line for this control again.
    Then you can manually check if there are differences.
    If not then something else is happening on this single computer

  26. #3266
    Addicted Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    203

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    My stomage says the VB.PropertyBag is corrupt at the registry of that 1 user.
    What does this mean and how is that possible?
    My installer copies all 25 SxS files (DLL/OCX) onto the computer without registering them.
    They are saved in a separate sub folder at the app's directory.
    Only VBCCR17.ocx triggers this error message.
    All the other 24 SxS files are fine, for example: RC6.DLL, cairo_sqlite.dll, msscript.ocx, mscomctl.ocx, zlibwapi.dll...
    The user installed the app for the first time.
    It looks like there are some special circumstances on that computer so Windows have problems to use the SxS technologie for this file.
    I already know i can fix this problem by registering the file but i really want to know what causes this problem...

  27. #3267
    Addicted Member
    Join Date
    Feb 2015
    Location
    Colorado USA
    Posts
    201

    Re: CommonControls (Replacement of the MS common controls)

    Krool says the type library has changed so I am guessing that one or more of the GUIDs in your resource file (or manifest) needs to be changed. It has nothing to do with registering the OCX since your clients are using SxS. Perhaps Krool can provide us with updated .RES files if the GUIIDs have changed.

  28. #3268

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,925

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by MountainMan View Post
    Krool says the type library has changed so I am guessing that one or more of the GUIDs in your resource file (or manifest) needs to be changed. It has nothing to do with registering the OCX since your clients are using SxS. Perhaps Krool can provide us with updated .RES files if the GUIIDs have changed.
    The GUIDS have NOT changed.

  29. #3269
    Member
    Join Date
    Oct 2007
    Posts
    50

    Re: CommonControls (Replacement of the MS common controls)

    Just a note of a problem (or perhaps just a "quirk"?) with RichTextBox: if you assign Unicode text to the RTB that is outside of the Unicode BMP (i.e. UTF-32 charcodes > 65535) while the characters may be able to display fine (Windows seems to "make it work" if it can), I discovered that if you then subsequently set the Font.Size property, it will make those characters outside of the BMP unreadable (they get changed to the standard "can't display this character rectangle symbol"). Interestingly, setting the font name property doesn't seem to cause this but only the font size.

    EDIT: I take it back - It does do this if any font properties have actually changed, including name. I guess this actually makes sense to a degree because if you assign a font or change font properties after text is assigned, it's presumably going to force the current text to take on whatever that font is which might not have the inherent support to display those characters. However, when you load text in (or type it) where the specified font cannot support the characters in question, Windows automatically looks for a font that CAN display it and seamlessly does so. But this same behavior doesn't occur if you set any font properties AFTER you load in/type text where any existing such characters that were displayed now become blank rectangles. This is a problem because with an RTB where a user can set Font name/size it means that if they change the font name or even just the size, any characters outside of the BMP that were being displayed fine will no longer display correctly.
    Last edited by chrislong2; Oct 30th, 2021 at 01:27 AM.

  30. #3270
    Addicted Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    203

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by MountainMan View Post
    Krool says the type library has changed so I am guessing that one or more of the GUIDs in your resource file (or manifest) needs to be changed.
    If this would be the case the app will not run anywhere w/o an error message and as i wrote before the app runs fine with 99,99% of all installations. So it is definitely not the manifest.

  31. #3271

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,925

    Re: CommonControls (Replacement of the MS common controls)

    Exotic bugfix for ListView control.

    It affects the FilterBar (edit control) not receiving focus on WM_LBUTTONDOWN when the previous focused control is a VB.CommandButton AND it is on a MDI child form.

    Reason is a unknown message &H105A pending on the MDI host form which brings focus back to the ActiveControl.

    Now the ListView control assures the ActiveControl is set prior the FilterBar will set the focus to the edit control so that &H105A will not disturb.

  32. #3272
    Addicted Member
    Join Date
    Jun 2017
    Posts
    196

    Re: CommonControls (Replacement of the MS common controls)

    Hi ~ Krool

    I find a issue


    Code:
    Private Sub Form_Load()
    For w = 1 To 5
    ComboBoxW1.AddItem w
    Next
    End Sub

    When Mouse Scroll on ComboBoxW1 List, Editor software in background will scroll

    Name:  GIF.gif
Views: 227
Size:  133.1 KB

    use ComboBoxW1.DisableNoScroll = True ?????

  33. #3273
    Addicted Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    203

    ForeColor not work using OptionButtonW or CheckBoxW

    VBCCR 1.7.35
    Win7-SP1
    VB6-SP6

    Im testing the controls for a Dark Mode and set the BackColor of several controls to Black and the ForeColor to White.
    Setting the ForeColor doesnt work with the OptionButtonW & CheckBoxW control:

    Name:  Screenshot - 13.11.2021 , 23_15_54.png
Views: 177
Size:  10.6 KB

    Can you fix this?

  34. #3274
    Addicted Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    203

    Re: CommonControls (Replacement of the MS common controls)

    I found out that the following content of the IDE manifest file causes the problem with the OptionButtonW and CheckBoxW control:

    Code:
      <dependency>
      	<dependentAssembly>
        	<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" language="*" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df"/>
      	</dependentAssembly>
      </dependency>
    After i removed the code above the ForeColor of these controls is White again.
    Do you have any idea how to fix this without removing the code from the IDE manifest file?

  35. #3275
    Lively Member
    Join Date
    Apr 2017
    Location
    India
    Posts
    105

    Re: CommonControls (Replacement of the MS common controls)

    Dear Krool,

    Great to have an opportunity to thank you once again.

    Well, I have the following queries with regard to VirtualCombo:

    1) Is it possible for users to add their own texts to a Virtual Combo? If so, how can it be done? If not, are there any plans to add that feature?

    2) What does "ExtendedUI = True" do in the case of a Virtual Combo? I somehow did not see any visual difference when I set it to True (from False).

    3) IncrementalSearch event - What is it for? When is it used? When I tried out the VirtualControlsForm demo in your 'ComCtlsDemo' project, I placed breakpoints in that event's code but I did not know what I should do so that these breakpoints are reached and I get to know what your code under that event is all about.

    4) How to effectively use 'AutoSelect' property? Actually, in your demo, after setting 'AutoSelect' property to True, and after changing the style of 'VirtualCombo1' to 0 or 1, if I type 'i', it immediately selects 'item0'. Afterwards, it does not allow me to use Backspace to delete any character. If I go to the beginning and press 'Delete' key, I am able to delete all the characters but once the typing area is empty, immediately 'item0' is selected. If I select the whole 'item0' text and delete it also, immediately 'item0' reappears. So, it feels like I am stuck with 'item0'. And hence, I am unable to understand what the AutoSelect feature is exactly for?

    Kind regards.

  36. #3276
    Lively Member
    Join Date
    Apr 2017
    Location
    India
    Posts
    105

    Re: CommonControls (Replacement of the MS common controls)

    Dear Krool,

    I observed the following with respect to VirtualCombo.

    1. In your demo, I changed the style of 'VirtualCombo1' to 0 and then ran the demo.
    2. In the starting screen, I clicked the combo's chevron to see the list drop down and selected an item (say 'item6').
    3. Then, I clicked the chevron again to close the list.
    4. Then, I again clicked the chevron to see the list drop down.
    5. What happens now is that the first 2 characters "it" get displayed (highlighted) in the typing area and 'item0' gets selected in the list.
    6. If I am right, I think this happens because "VListBox1_FindVirtualItem" event gets called with SearchText as "it", when I click the chevron again (in Step 4)

    I actually tried with one of my own VirtualCombos too with some words filled in it (Apple, Bag, Basket, Ball, Cat). Same thing happens. For instance, I select 'Ball' and close the list. Then, if I click the chevron again, 'Ba' appears highlighted in the typing area with 'Bag' selected in the list.

    So, what to do if the above issue should not arise?

    Taking this opportunity to thank you once again for all your free controls.

    Kind regards.

  37. #3277
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    6,936

    Re: CommonControls (Replacement of the MS common controls)

    Hey Krool ... on your RichTextBox, you made the .Text property accept full Unicode. I'm wondering why you didn't do the same to the .TextRTF property?

    I do sometimes use something like WordPad to generate an RTF string, and then use it in my code. I just discovered that you can't use Unicode while setting this .TextRTF property.
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  38. #3278
    Hyperactive Member
    Join Date
    Aug 2016
    Posts
    366

    Re: CommonControls (Replacement of the MS common controls)

    If (PropFlags And (CdlPDReturnDC Or CdlPDReturnIC)) <> 0 Then
    If PropDC <> 0 Then DeleteObject PropDC
    PropDC = PDLGEX.hDC
    End If
    What is PropDC representing and purpose? I am confused with Printer.hdc

  39. #3279

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,925

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Elroy View Post
    Hey Krool ... on your RichTextBox, you made the .Text property accept full Unicode. I'm wondering why you didn't do the same to the .TextRTF property?

    I do sometimes use something like WordPad to generate an RTF string, and then use it in my code. I just discovered that you can't use Unicode while setting this .TextRTF property.
    I don't know what you mean. The SF_RTF is ANSI always, also in WordPad.
    The SF_UNICODE flag cannot be combined with SF_RTF.

    Quote Originally Posted by DaveDavis View Post
    What is PropDC representing and purpose? I am confused with Printer.hdc
    The Printer Dialog can return a hDC so you can pass it to API's.
    That's often more useful as you can't use Printer.hdc in case the printer has an unicode name in VB6.
    It's more flexible to be independent of the VB6 printer object.

    Quote Originally Posted by Mith View Post
    I found out that the following content of the IDE manifest file causes the problem with the OptionButtonW and CheckBoxW control:

    Code:
      <dependency>
      	<dependentAssembly>
        	<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" language="*" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df"/>
      	</dependentAssembly>
      </dependency>
    After i removed the code above the ForeColor of these controls is White again.
    Do you have any idea how to fix this without removing the code from the IDE manifest file?
    The themed button controls do ignore the ForeColor.
    Blame MS as they still use DrawThemeText instead of DrawThemeTextEx in their button classes..
    Workaround would be to NM_CUSTOMDRAW the buttons so the text will be theme drawed with colors.
    If it's only text it would be easy but if there are pictures/image lists involved it get's complicated..

    Quote Originally Posted by quickbbbb View Post
    Hi ~ Krool

    I find a issue


    Code:
    Private Sub Form_Load()
    For w = 1 To 5
    ComboBoxW1.AddItem w
    Next
    End Sub

    When Mouse Scroll on ComboBoxW1 List, Editor software in background will scroll

    Name:  GIF.gif
Views: 227
Size:  133.1 KB

    use ComboBoxW1.DisableNoScroll = True ?????
    I don't get it. Can you provide a demo?
    Doesn't it have something todo that on newer OS the mouse scroll receiver is nowadays the "window under cursor" instead of the "window which has focus" ?
    Last edited by Krool; Nov 17th, 2021 at 02:31 AM.

  40. #3280
    Addicted Member
    Join Date
    Jun 2017
    Posts
    196

    Re: CommonControls (Replacement of the MS common controls)

    hi ~ Krool
    Quote Originally Posted by Krool View Post
    I don't get it. Can you provide a demo?
    Doesn't it have something todo that on newer OS the mouse scroll receiver is nowadays the "window under cursor" instead of the "window which has focus" ?

    Run in exe + Win7_64bit

    =====================

    cc.zip

    =====================





    ====================

    IF Run in VB IDE
    -> mouse click comboBox drop list ( VB IDE is in background )
    -> mouse start scroll on comboBox drop list
    -> mouse focus will auto jump to VB IDE immediately
    , and VB IDE start scroll ( because VB IDE get focus and goto foreground )


    ======================

    For w = 1 To 100 '-----> 5 change as 100
    ComboBoxW1.AddItem w
    Next

    if w is from 5 change to 100 , the strange issue will disappear

    ComboBoxW1 drop list will scroll correctly
    Last edited by quickbbbb; Nov 17th, 2021 at 08:19 AM.

Page 82 of 83 FirstFirst ... 32727980818283 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width