Results 1 to 30 of 30

Thread: Krool's CommonControls cut out for Onesie-Twosie use

  1. #1

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    8,719

    Krool's CommonControls cut out for Onesie-Twosie use

    Update: On Jan 1, 2023, Krool notified me that there was a bug in the VTableHandle.bas module that he was concerned about (that he fixed subsequent to Nov 14, 2021). That VTableHandle.bas module has been replaced in all 18 of the following attachments, with spot testing (that shows everything seems to still work). For more minor changes, you are referred to Krool's full set.

    Ok, this is Krool's work, not mine. And this is done "with his permission".

    I just downloaded his most recent copy (on November 14, 2021), and I'll probably stick with this copy, as I do feel that his work is quite mature at this point. If you want a more recent version of his code, you're on your own.

    What I've done (and will build upon) is to "cut out" the individual controls from his "controls package". I'm also cutting out any/all of his custom property pages, so, if you wish to have Unicode text, captions, etc, you must set them at runtime. I cut out these property pages because leaving them makes this all much more complex, as his property pages also use his controls, which makes everything quite "interwoven". Without these property pages, it's much easier to isolate individual controls.

    I'm just going to post small "demo" projects that have the individual "cut out" controls. In all cases, it'll just be a Project1.vbp and a Form1.frm (with Krool's single control on it). There are no sub-folders in the attached zip files. Everything you need is just all together.

    In almost all cases, Krool also requires use of his OLEGuids.tlb typelib. And, this must be registered (with RegTLib.exe) on your computer, and then the reference in the Project1.vbp must be updated.

    This piece can be a bit tricky:

    • I'd delete any older copies of Krool's OLEGuids.tlb file from your computer, as older versions aren't compatible with his most recent release.
    • I've included a copy of this OLEGuids.tlb in each of the following projects, but it's only needed once. In fact, personally, I keep the most recent version in my C:\Windows\SysWOW64 folder, registered there with RegTLib.exe. ( C:\windows\syswow64> regtlib oleguids.tlb )
    • Note that this OLEGuids.tlb file is no longer needed once your project is compiled to an executable (exe). In other words, it's only needed on your development machine, and other users won't need to worry about it.
    • When refreshing the reference to this OLEGuids.tlb file in any project, you typically must unreference any prior reference, and then browse to and re-reference the copy you've got registered on your computer, using the Project --> References option in your VB6 IDE.

    All this should make it easy to add a single (or a couple) of Krool's controls to your own project. Just drag all the necessary files to your project (and also reference the OLEGuids.tlb in your project), and then you can use the control(s) from your toolbox.

    Anytime I've made any change to Krool's code, I will make notes on that in these posts. I hope to not make any changes at all.

    Also, as a note, if you intend to use two or three of Krool's controls in a single project (getting them from this CodeBank thread), you'll run into module redundancy. For instance, Krool's Common.bas module is used by pretty much all of his controls. However, I've included a copy of it in each of the "cut out" controls in this thread. But, since I haven't made any changes to his source code, just ignore that redundancy, and just include a single copy in your project.

    Also, you can individually compile these as OCXs, but you're on your own regarding that one. If you're going to do that, I don't see why you don't just use Krool's complete OCX.

    That's about it. I'll start with his TextBoxW control, and add more as I get them done. Only five attachments per post, so see subsequent posts.

    p.s. I probably won't do every single one, as I'll focus on the controls in my primary project. However, you should be able to use my work as a template for pulling out any of Krool's controls from his larger project.
    Attached Files Attached Files
    Last edited by Elroy; Jan 25th, 2023 at 10:55 AM.
    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.

  2. #2

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    8,719

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    More...
    Attached Files Attached Files
    Last edited by Elroy; Jan 25th, 2023 at 10:47 AM.
    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.

  3. #3

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    8,719

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    And more...
    Attached Files Attached Files
    Last edited by Elroy; Jan 25th, 2023 at 10:51 AM.
    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.

  4. #4

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    8,719

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    And yet more...

    (And other than the MsFlxGrd control, which Krool as done separately, and the SSTab control, which Eduardo has done ... that's about all I'd ever use. Again, it's an easy template to follow if you want to isolate other controls that Krool as done.)
    Attached Files Attached Files
    Last edited by Elroy; Jan 25th, 2023 at 10:52 AM.
    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.

  5. #5
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    516

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    We have to refer back to Krool's original work because he apply updates and bug fixes from time to time.

  6. #6
    Frenzied Member
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    1,667

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    Quote Originally Posted by Elroy View Post
    I'm just going to post small "demo" projects that have the individual "cut out" controls.
    Thankyou!
    By the power invested in me, all the threads I start are Niya and Olaf free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  7. #7
    Frenzied Member
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    1,667

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    Elroy, can you just check your TextBoxW vbp and see if it compiles, I am receiving a Compile error:

    "Procedure declaration does not match description of event or procedure having the same name"

    in:

    Private Sub IOleInPlaceActiveObjectVB_TranslateAccelerator(ByRef Handled As Boolean, ByRef RetVal As Long, ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long, ByVal Shift As Long)

    I have the project references set and the typelib registered. I feel that I managed to get to the same point when I was stripping out Krool's code myself to just the TextBoxW. I couldn't move past this as I am at the limits of my understanding and capability.
    By the power invested in me, all the threads I start are Niya and Olaf free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  8. #8

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    8,719

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    Quote Originally Posted by yereverluvinuncleber View Post
    Elroy, can you just check your TextBoxW vbp and see if it compiles, I am receiving a Compile error:

    "Procedure declaration does not match description of event or procedure having the same name"

    in:

    Private Sub IOleInPlaceActiveObjectVB_TranslateAccelerator(ByRef Handled As Boolean, ByRef RetVal As Long, ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long, ByVal Shift As Long)

    I have the project references set and the typelib registered. I feel that I managed to get to the same point when I was stripping out Krool's code myself to just the TextBoxW. I couldn't move past this as I am at the limits of my understanding and capability.

    Ber, you don't have the OLEGuids.tlb typelib registered and/or the reference to it refreshed correctly. I just tried running it, and also compiled it to an EXE, and everything worked fine. Then, I deleted my registered copy of Krool's OLEGuids.tlb typelib, and then got the same error you're saying. Please read this section of my OP carefully, as you must register (and then refresh that dependency in the project), and then everything will work fine.

    Also, just as a note, once compiled (to EXE) you no longer need this typelib ... and it doesn't need to be distributed with your application.

    EDIT: I just re-read your post and see that you tried to do what I stated. Hmmm, I'd try a reboot, and then try re-registering and re-refreshing the reference in the IDE of Project1.vbp. Beyond that, I'm not sure, as I can't reproduce the problem here. I suppose you might try loading the Project1.vbp with an editor, deleting the reference line to OLEGuids.tlb, then re-load it in the IDE and re-browse (i.e., refresh the reference) to this typelib.
    Last edited by Elroy; Nov 15th, 2021 at 08:45 AM.
    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.

  9. #9

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    8,719

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    Quote Originally Posted by DaveDavis View Post
    We have to refer back to Krool's original work because he apply updates and bug fixes from time to time.
    Dave, you are absolutely correct, and I stated as much in my OP. I just felt that his controls were relatively mature at this point, with few (if any) changes occurring in the future on the ones on which I'd be focusing. However, you should be able to use what I've done as a template for re-doing it with Krool's future versions. All I've done is to gather up the necessary modules to make the individual controls work. In most cases, it's just the ComCtrlsBase.bas, Common.Bas, VisualStyles.bas, VTableHandle.bas, ISubclass.cls, and then the OLEGuids.tlb (registered and reference refreshed) ... along with the CTL and CTX of the control you want.
    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.

  10. #10
    Frenzied Member
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    1,667

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    Quote Originally Posted by Elroy View Post
    EDIT: I just re-read your post and see that you tried to do what I stated. Hmmm, I'd try a reboot, and then try re-registering and re-refreshing the reference in the IDE of Project1.vbp. Beyond that, I'm not sure, as I can't reproduce the problem here. I suppose you might try loading the Project1.vbp with an editor, deleting the reference line to OLEGuids.tlb, then re-load it in the IDE and re-browse (i.e., refresh the reference) to this typelib.
    I will do that now, thanks for your help, will report back in an hour or two.
    FYI - I was able to compile Krool's comCtlsDemo flawlessly so that may prove something.
    By the power invested in me, all the threads I start are Niya and Olaf free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  11. #11

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    8,719

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    Quote Originally Posted by yereverluvinuncleber View Post
    I will do that now, thanks for your help, will report back in an hour or two.
    FYI - I was able to compile Krool's comCtlsDemo flawlessly so that may prove something.
    While in Project1 in the IDE, and attempting to refresh the reference, be sure you're browsing to your registered copy of the OLEGuids.tlb typelib. Personally, I'd just make a copy of this typelib and place it in my C:\Windows\SysWOW64, and then register it there, pointing all my references to that copy. Again, once compiled to an EXE, you can forget about this OLEGuids.tlb typelib, so it's just a "thing" on your development machine.

    EDIT: See my indented edits to the OP for more details on this.
    Last edited by Elroy; Nov 15th, 2021 at 01:38 PM.
    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.

  12. #12
    Hyperactive Member
    Join Date
    Jun 2016
    Location
    España
    Posts
    367

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    good job Elroy

  13. #13
    Frenzied Member
    Join Date
    May 2014
    Location
    Kallithea Attikis, Greece
    Posts
    1,225

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    Elroy,
    The resource file missing from examples. So if anyone compile one example, gets the wrong idea about the control.
    The resource file has an AVI section, I don't now why, I just can't remember where I found it. Perhaps its from Krool's example.

    Name:  good.png
Views: 565
Size:  6.4 KBName:  bad.png
Views: 595
Size:  6.1 KB
    Attached Files Attached Files

  14. #14
    Frenzied Member
    Join Date
    May 2014
    Location
    Kallithea Attikis, Greece
    Posts
    1,225

    How To Place a Nice ToolTip in TextBoxW

    In a module modToolTip.bas copy this. You can update any control, just do the same.
    Code:
    Private Type TOOLINFO
        lSize       As Long
        lFlags      As Long
        hWnd        As Long
        lId         As Long
        '
        'lpRect      As RECT
        Left        As Long
        Top         As Long
        Right       As Long ' This is +1 (right - left = width)
        Bottom      As Long ' This is +1 (bottom - top = height)
        '
        hInstance   As Long
        lpStr       As String
        lParam      As Long
    End Type
    '
    Private Declare Function SendMessageLong Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
    Private Declare Sub InitCommonControls Lib "comctl32" ()
    Private Declare Function CreateWindowExW Lib "user32" (ByVal dwExStyle As Long, ByVal lpClassName As Long, ByVal lpWindowName As Long, ByVal dwStyle As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
    Private Declare Function DestroyWindow Lib "user32" (ByVal hWnd As Long) As Long
    ''
    Private Const WM_USER               As Long = &H400&
    Private Const CW_USEDEFAULT         As Long = &H80000000
    '
    Private Const TTM_ACTIVATE          As Long = WM_USER + 1&
    'Private Const TTM_ADDTOOLA          As Long = WM_USER + 4&
    Private Const TTM_ADDTOOLW          As Long = WM_USER + 50&
    Private Const TTM_SETDELAYTIME      As Long = WM_USER + 3&
    'Private Const TTM_UPDATETIPTEXTA    As Long = WM_USER + 12&
    Private Const TTM_UPDATETIPTEXTW    As Long = WM_USER + 57&
    Private Const TTM_SETTIPBKCOLOR     As Long = WM_USER + 19&
    Private Const TTM_SETTIPTEXTCOLOR   As Long = WM_USER + 20&
    Private Const TTM_SETMAXTIPWIDTH    As Long = WM_USER + 24&
    'Private Const TTM_SETTITLEA         As Long = WM_USER + 32&
    Private Const TTM_SETTITLEW         As Long = WM_USER + 33&
    '
    Private Const TTS_NOPREFIX          As Long = &H2&
    Private Const TTS_BALLOON           As Long = &H40&
    Private Const TTS_ALWAYSTIP         As Long = &H1&
    '
    Private Const TTF_CENTERTIP         As Long = &H2&
    Private Const TTF_IDISHWND          As Long = &H1&
    Private Const TTF_SUBCLASS          As Long = &H10&
    Private Const TTF_TRANSPARENT       As Long = &H100&
    '
    Private Const TTDT_AUTOPOP          As Long = 2&
    Private Const TTDT_INITIAL          As Long = 3&
    '
    Private Const TOOLTIPS_CLASS        As String = "tooltips_class32"
    '
    Public Enum ttIconType
        TTNoIcon
        TTIconInfo
        TTIconWarning
        TTIconError
    End Enum
    #If False Then ' Intellisense fix.
        Public TTNoIcon, TTIconInfo, TTIconWarning, TTIconError
    #End If
    '
    Private hwndTT As Long ' hwnd of the tooltip
    Public Ide As Boolean
    Public Function GetHWndForToolTip(ByVal ctl As Object) As Long
        ' This returns the control's hWnd, or it keeps crawling up
        ' into containers until it finds one with a valid hWnd.
        ' Ultimately, the top-level form always has a hWnd.
        On Error Resume Next
            Do
                GetHWndForToolTip = ctl.hWnd
                If Err = 0 Then Exit Do
                Err.Clear
                Set ctl = ctl.Container                 ' This will still work for controls nested on a container on a UC.
                If Err <> 0 Then                        ' Apparently it's directly on a UC.  At this point, Container will be the UC (if Err).
                    Err.Clear
                    Set ctl = ctl.Extender.Container    ' Extender must be exposed for this to work.
                    If Err <> 0 Then
                        On Error GoTo 0
                        Error 438                       ' Apparently it's on a UC and the Extender wasn't exposed.
                        Exit Function
                    End If
                End If
            Loop
        On Error GoTo 0
    End Function
    Function InIDE() As Boolean
    Ide = True
    InIDE = True
    End Function
    Public Function CreateToolTip(ByVal ParentHwnd As Long, _
                             ByVal TipText As String, _
                             Optional ByVal uIcon As ttIconType = TTNoIcon, _
                             Optional ByVal sTitle As String, _
                             Optional ByVal lForeColor As Long = -1&, _
                             Optional ByVal lBackColor As Long = -1&, _
                             Optional ByVal bCentered As Boolean, _
                             Optional ByVal bBalloon As Boolean, _
                             Optional ByVal lWrapTextLength As Long = 50&, _
                             Optional ByVal lDelayTime As Long = 200&, _
                             Optional ByVal lVisibleTime As Long = 5000& _
                            ) As Boolean
        '
        ' If lWrapTextLength = 0 then there will be no wrap.
        ' Also, lWrapTextLength = 40 is a minimum value.
        ' The max for lVisibleTime is 32767.
        '
        'Static bCommonControlsInitialized As Boolean
        
        Debug.Assert InIDE
        If Ide Then Exit Function
        CreateToolTip = True
        Dim lWinStyle As Long
        Dim TI As TOOLINFO
        Static PrevParentHwnd As Long
        Static PrevTipText As String
        Static PrevTitle As String
        '
        ' Don't do anything unless we need to.
        If hwndTT <> 0 And ParentHwnd = PrevParentHwnd And TipText = PrevTipText And sTitle = PrevTitle Then Exit Function
        '
       ' If Not bCommonControlsInitialized Then
        '    InitCommonControls
        '    bCommonControlsInitialized = True
        'End If
        '
        ' Destroy any previous tooltip.
        If hwndTT <> 0 Then DestroyWindow hwndTT
        '
        ' Format the text.
        FormatTooltipText TipText, lWrapTextLength
        '
        ' Initial style settings.
        lWinStyle = TTS_ALWAYSTIP Or TTS_NOPREFIX
        If bBalloon Then lWinStyle = lWinStyle Or TTS_BALLOON ' Create baloon style if desired.
        ' Set the style.
        hwndTT = CreateWindowExW(0&, StrPtr(TOOLTIPS_CLASS), 0&, lWinStyle, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0&, 0&, App.hInstance, 0&)
        '
        ' Setup our tooltip info structure.
        TI.lFlags = TTF_SUBCLASS Or TTF_IDISHWND
        If bCentered Then TI.lFlags = TI.lFlags Or TTF_CENTERTIP
        ' Set the hwnd prop to our parent control's hwnd.
        TI.hWnd = ParentHwnd
        TI.lId = ParentHwnd
        TI.hInstance = App.hInstance
        TI.lpStr = TipText
        TI.lSize = LenB(TI)
        ' Set the tooltip structure
        SendMessageLong hwndTT, TTM_ADDTOOLW, 0&, VarPtr(TI)
        SendMessageLong hwndTT, TTM_UPDATETIPTEXTW, 0&, VarPtr(TI)
        '
        ' Colors.
        If lForeColor <> -1 Then SendMessage hwndTT, TTM_SETTIPTEXTCOLOR, lForeColor, 0&
        If lBackColor <> -1 Then SendMessage hwndTT, TTM_SETTIPBKCOLOR, lBackColor, 0&
               ' If MultiLine = True Then
                SendMessage hwndTT, TTM_SETMAXTIPWIDTH, 0&, 0  'Set to multiline
            'End If
        '
        ' Title or icon.
        If uIcon <> TTNoIcon Or sTitle <> vbNullString Then SendMessageLong hwndTT, TTM_SETTITLEW, CLng(uIcon), StrPtr(sTitle)
        '
        SendMessageLong hwndTT, TTM_SETDELAYTIME, TTDT_AUTOPOP, lVisibleTime
        SendMessageLong hwndTT, TTM_SETDELAYTIME, TTDT_INITIAL, lDelayTime
        '
        PrevParentHwnd = ParentHwnd
        PrevTipText = TipText
        PrevTitle = sTitle
    End Function
    
    
    Public Sub DestroyToolTip()
        ' It's not a bad idea to put this in the Form_Unload event just to make sure.
        If hwndTT <> 0 Then DestroyWindow hwndTT
        hwndTT = 0
    End Sub
    
    
    Private Sub FormatTooltipText(TipText As String, lLen As Long)
        Dim s As String
        Dim i As Long
        '
        ' Make sure we need to do anything.
        If lLen = 0 Then Exit Sub
        If lLen < 40 Then lLen = 40
        If Len(TipText) <= lLen Then Exit Sub
        '
        Do
            i = InStrRev(TipText, " ", lLen + 1)
            If i = 0 Then
                s = s & Left$(TipText, lLen) & vbCrLf ' Build "s" and trim from TipText.
                TipText = Mid$(TipText, lLen + 1)
            Else
                s = s & Left$(TipText, i - 1) & vbCrLf ' Build "s" and trim from TipText.
                TipText = Mid$(TipText, i + 1)
            End If
            If Len(TipText) <= lLen Then
                TipText = s & TipText ' Place "s" back into TipText and get out.
                Exit Sub
            End If
        Loop
    End Sub
    Now in the TextBoxW
    At General
    Code:
    Private PropToolTipText As String, PropToolTipTitle As String
    At init properties
    Code:
    PropToolTipText = vbNullString
    PropToolTipTitle = vbNullString
    At read properties
    Code:
    PropToolTipText = .ReadProperty("ToolTipEx", vbNullString)
    PropToolTipTitle = .ReadProperty("ToolTipExTitle", vbNullString)
    ' ----- Upgrade/Downgrade tooltip -- need MouseTrack = True
    If Extender.ToolTipText <> "" And PropToolTipText = "" Then
        PropToolTipText = Extender.ToolTipText
    End If
    ToolTipText = PropToolTipText
    ' --- use this for upgrade automatic all controls----
    MouseTrack = PropToolTipText <> vbNullString Or MouseTrack
    at write properties
    Code:
    .WriteProperty "ToolTipEx", PropToolTipText, vbNullString
    .WriteProperty "ToolTipExTitle", PropToolTipTitle, vbNullString
    Add New Properties
    Code:
    Public Property Let ToolTipTextTitle(ByVal Value As String)
    PropToolTipTitle = Value
    UserControl.PropertyChanged "ToolTipExTitle"
    End Property
    Public Property Get ToolTipTextTitle() As String
    ToolTipTextTitle = PropToolTipTitle
    End Property
    Public Property Get ToolTipTextEx() As String
    ToolTipTextEx = PropToolTipText
    End Property
    Public Property Let ToolTipTextEx(ByVal Value As String)
    PropToolTipText = Value
    If Value <> vbNullString And Visible Then
        If Not CreateToolTip(hWnd, PropToolTipText, , PropToolTipTitle, , , , True) Then
            Extender.ToolTipText = PropToolTipText
            UserControl.PropertyChanged "ToolTipTextEx"
        Else
        Extender.ToolTipText = ""
            If Not PropMouseTrack Then
                PropMouseTrack = True
                UserControl.PropertyChanged "MouseTrack"
            End If
        End If
    End If
    End Property
    And now the trick part. Find that:
    Code:
    Private Function WindowProcControl(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    Select Case wMsg
    Go down to Cases showing here and do the changes:
    Code:
    Case WM_MOUSEMOVE
        If TextBoxMouseOver = False And PropMouseTrack = True Then
            TextBoxMouseOver = True
            Extender.ToolTipText = vbNullString
            If Not CreateToolTip(hWnd, PropToolTipText, , PropToolTipTitle, , , , True) Then
                Extender.ToolTipText = PropToolTipText
            End If
            RaiseEvent MouseEnter
            Call ComCtlsRequestMouseLeave(hWnd)
        End If
        RaiseEvent MouseMove(GetMouseStateFromParam(wParam), GetShiftStateFromParam(wParam), X, Y)
    And the last case
    Code:
    Case WM_MOUSELEAVE
        If TextBoxMouseOver = True Then
            TextBoxMouseOver = False
            DestroyToolTip
            RaiseEvent MouseLeave
        End If
    GK

  15. #15

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    8,719

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    Quote Originally Posted by georgekar View Post
    Elroy,
    The resource file missing from examples. So if anyone compile one example, gets the wrong idea about the control.
    The resource file has an AVI section, I don't now why, I just can't remember where I found it. Perhaps its from Krool's example.
    Ok, you're right, Krool does have his project manifested. Here's the manifest he's using:

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
       <dependency>
          <dependentAssembly>
             <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" language="*" processorArchitecture="*" publicKeyToken="6595b64144ccf1df"/>
          </dependentAssembly>
       </dependency>
    </assembly>
    I've just tried it with and without that manifest, and I'm not sure I see any difference, or why there'd be any (from what's in that manifest). However, you're certainly welcome to include it. I've attached a file named KroolControlsManifest.txt (which is just the above) and a file named Project1.res (with nothing but that manifest in it) to this post. If you want to use Krool's manifest, just drag that Project1.res file into whatever project you like.

    Just FYI, to see that, all I did was run the following in the Immediate window (using his complete demo project): ? StrConv(LoadResData(1, 24), vbUnicode)

    The only other thing in his resources is a file named AnimationDemo.avi that he uses to demonstrate his animation control. I doubt I'll be messing with that control, so I won't be needing that file.

    -----

    Regarding your latest post, I'm not sure what you're getting at, as all I'm trying to do is provide small projects with a single control (one of Krool's controls) in each project. If people want to enhance from there, they're certainly welcome to do whatever they'd like. I'm trying my best to leave his source code untouched, and have so far.
    Attached Files Attached Files
    Last edited by Elroy; Nov 15th, 2021 at 05:33 PM.
    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.

  16. #16
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    516

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    hi Elroy:
    Is it possible to make those individual controls with wqweto's "ModernSubclassingThunk" and remove tlb and ComCtlsBase.bas, Common.bas, VisualStyles.bas dependencies?
    I need a stable TextBoxW and ListBoxW. (Right now my app crashed randomly after I swap both controls.)
    Last edited by DaveDavis; Jan 24th, 2023 at 08:22 PM.

  17. #17
    Frenzied Member
    Join Date
    May 2014
    Location
    Kallithea Attikis, Greece
    Posts
    1,225

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    I use the some of krools controls, and sometime the IDE crashes, but never crash in the compiling exe.

    You have to insert in sub main:
    Call InitVisualStylesFixes

    So you have to adjust the start up object to sub main in Project Properties.
    close all user controls designer window. If it is open, first close it and then perform "update controls" in a form which is open (from context menu, the last option is the Update User Controls.

    Always save your program at regular steps of editing (when you are sure that is ok until then). I think I save the code very frequent, but this us never a bad idea.

  18. #18

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    8,719

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    Quote Originally Posted by georgekar View Post
    So you have to adjust the start up object to sub main in Project Properties.
    It seems like you could put it in Form_Initialize. That's raised before the form is loaded. It's the initialization of the COM/code portion of the form, which gets instantiated before the form is loaded.
    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.

  19. #19

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    8,719

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    And DaveDavis, it's not going to be me that does the work to use another form of subclassing in Krool's controls. The main reason being that I'd hate to fork Krool's work like that. You'd be better off asking if he'd be interested in doing it.

    Also, maybe use Krool's OCX. Yeah, once compiled, you shouldn't have any problems.
    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.

  20. #20
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    516

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    Quote Originally Posted by Elroy View Post
    And DaveDavis, it's not going to be me that does the work to use another form of subclassing in Krool's controls. The main reason being that I'd hate to fork Krool's work like that. You'd be better off asking if he'd be interested in doing it.

    Also, maybe use Krool's OCX. Yeah, once compiled, you shouldn't have any problems.
    The reason are:
    1. the OLEGuilds.tlb has conflicts (or confuses) with either olexp.tlb or 'Edanmo's OLE interfaces & fuctions V1.81". My UserControl used all three unfortunately.
    2. I can't figure out what is the three bas are doing, they are complex for me.
    3. The Subclass has less efficiencies (I could be wrong) than Paul or wqweto's Subclassing which can do subclassing On demand.

  21. #21
    Fanatic Member
    Join Date
    Aug 2020
    Posts
    944

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    I've tested almost all of the Subclass techniques except wqweto's Subclassing, but RC5/RC6.Subclass seems to use a similar technique to wqweto's Subclassing.

    My conclusion is that as long as you use Subclassing, then you can never avoid IDE crashes.

  22. #22
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    3,709

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    Quote Originally Posted by DaveDavis View Post
    The reason are:
    1. the OLEGuilds.tlb has conflicts (or confuses) with either olexp.tlb or 'Edanmo's OLE interfaces & fuctions V1.81". My UserControl used all three unfortunately.
    2. I can't figure out what is the three bas are doing, they are complex for me.
    3. The Subclass has less efficiencies (I could be wrong) than Paul or wqweto's Subclassing which can do subclassing On demand.
    oleexp.tlb is an expansion of olelib.tlb, and I didn't remove anything from the original, so there's no scenario where you'd need both. The newer versions of VBCCR I've seen are good about explicitly qualifying things to reduce conflicts... i.e. declaring interfaces as OLEGuids.IWhatever instead of just IWhatever. The API declares won't conflict because VB prioritizes locally declared versions over TLB-defined versions, so you shouldn't have a problem with VBCCR's subclassing; I use Krool's controls along side oleexp quite a bit and don't have any issues with it.

  23. #23

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    8,719

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    Quote Originally Posted by SearchingDataOnly View Post
    My conclusion is that as long as you use Subclassing, then you can never avoid IDE crashes.
    Boy, that statement needs a lot more context. I use subclassing all the time, and I virtually never crash the IDE. The primary time I crash the IDE is while actually developing a subclassing procedure, and I'm possibly not completely sure how to make some API calls within the subclass procedure itself. But, in normal development, with well debugged subclass procedures, I virtually never have problems, and I don't even use a thunk with my subclassing. But I do use the new comctl32 method of subclassing, and I do follow a few rules when I'm working with a project that contains subclassing.
    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.

  24. #24
    Fanatic Member
    Join Date
    Aug 2020
    Posts
    944

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    Quote Originally Posted by Elroy View Post
    Boy, that statement needs a lot more context. I use subclassing all the time, and I virtually never crash the IDE. The primary time I crash the IDE is while actually developing a subclassing procedure, and I'm possibly not completely sure how to make some API calls within the subclass procedure itself. But, in normal development, with well debugged subclass procedures, I virtually never have problems, and I don't even use a thunk with my subclassing. But I do use the new comctl32 method of subclassing, and I do follow a few rules when I'm working with a project that contains subclassing.
    You should tell other people who use Krool's CommonControls how to never crash the IDE.

  25. #25
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    3,709

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    Quote Originally Posted by SearchingDataOnly View Post
    You should tell other people who use Krool's CommonControls how to never crash the IDE.
    Don't try to edit and continue.

  26. #26
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    516

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    Quote Originally Posted by fafalone View Post
    i.e. declaring interfaces as OLEGuids.IWhatever instead of just IWhatever.
    Good tips...
    I used olelib.IStorage and olelib.IStream for some purpose. I will try to use olexp.tlb.

    I use Krool's controls along side oleexp quite a bit and don't have any issues with it.
    After I use TextBoxW, my app crash during closing. I will investigate whether the subclasser problem or tlb problem.

  27. #27
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    3,709

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    IStorage and IStream have not been modified at all from olelib, so you can definitely use them with zero change to code besides changing olelib.IStorage to oleexp.IStorage (or just IStorage) and same for IStream.

  28. #28

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    8,719

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    NOTICE: Krool has contacted me about a bug that needs to be fixed.

    ADDED: Now fixed ... see Update notice on OP.

    If you're using code from this thread downloaded prior to Jan 25, 2023 and you'd like this update, all that's necessary is that you download any of the above (post #1 thru #4) attachments, and replace the VTableHandle.bas module you're using with the one found in the attachment. It's the exact same file in all the attachments.
    Last edited by Elroy; Jan 25th, 2023 at 10:59 AM.
    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.

  29. #29
    Frenzied Member
    Join Date
    May 2014
    Location
    Kallithea Attikis, Greece
    Posts
    1,225

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    Has anyone update the any control with balloon tooltip (the code/changes_to_do I post at a previous post)?

    I use the tooltip, on TextBoxW and on CommandBoxW without problems.

    You can use Title if you like: See this example from my app.
    Attached Images Attached Images   

  30. #30
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    516

    Re: Krool's CommonControls cut out for Onesie-Twosie use

    Quote Originally Posted by Elroy View Post
    NOTICE: Krool has contacted me about a bug that needs to be fixed.

    ADDED: Now fixed ... see Update notice on OP.

    If you're using code from this thread downloaded prior to Jan 25, 2023 and you'd like this update, all that's necessary is that you download any of the above (post #1 thru #4) attachments, and replace the VTableHandle.bas module you're using with the one found in the attachment. It's the exact same file in all the attachments.
    For nElemCount = 0 To cElems - 1
    Buffer = StringsOutArray(nElemCount) & vbNullChar
    lpString = CoTaskMemAlloc(LenB(Buffer))
    CopyMemory ByVal lpString, ByVal StrPtr(Buffer), LenB(Buffer)
    CopyMemory ByVal UnsignedAdd(pElems, nElemCount * 4), ByVal VarPtr(lpString), 4
    Next nElemCount
    This fix finally solved my crash issue. Thank Krool and Elroy.

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