Page 3 of 3 FirstFirst 123
Results 81 to 111 of 111

Thread: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

  1. #81
    New Member
    Join Date
    Dec 2020
    Posts
    2

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Krool, thanks for the great work!

    I tried to place the "[VB6] ActiveX CommonControls" in the MS VFP's IDE:

    LabelW's OK!
    CommandButtonW's OK!
    CheckBoxW's OK!
    RichTextBox's OK!
    TreeView's OK!

    But unfortunately "TextBoxW" CRASHED while I just placed it into the Form in DesignMode! I've download the "UniText"(https://www.vbforums.com/showthread....ase-2008-06-19) before, it's OK. I think maybe there's something wrong with TextBoxW during UserControl_Initialize() while TextBoxDesignMode's True.

  2. #82

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,108

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by myfav View Post
    Krool, thanks for the great work!

    I tried to place the "[VB6] ActiveX CommonControls" in the MS VFP's IDE:

    LabelW's OK!
    CommandButtonW's OK!
    CheckBoxW's OK!
    RichTextBox's OK!
    TreeView's OK!

    But unfortunately "TextBoxW" CRASHED while I just placed it into the Form in DesignMode! I've download the "UniText"(https://www.vbforums.com/showthread....ase-2008-06-19) before, it's OK. I think maybe there's something wrong with TextBoxW during UserControl_Initialize() while TextBoxDesignMode's True.
    Hmm. I don't know. Why does the more complex RichTextBox work but not the TextBox?
    IMO UserControl_Initialize is not the cause as TextBoxDesignMode's not True there yet.
    Can you compile the OCX again for testing and put off Call CreateTextBox in sub _InitProperties and _ ReadProperties?
    So we pinpoint if it has something todo with the UserControl or the API window.

  3. #83
    Addicted Member
    Join Date
    Feb 2015
    Location
    Colorado USA
    Posts
    247

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Version 3 of the Documentation and Compile Utility for Krool's controls has been released here.

    MountainMan

  4. #84
    Junior Member
    Join Date
    Sep 2019
    Posts
    22

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    First of all, thank you very much for your efforts, Krool. Your controls work very reliably and I use them quite often these days.

    I do have an issue with ImageLists and property pages, though. Here's how to reproduce:

    1. Create a new project and add a reference to VBCCR17
    2. Add two image list controls to a form
    3. Open the property page and add an image
    4. Now, without closing the property page select the second image list and add an image
    5. Upon selecting an image the IDE produces a run-time error 0

    Afterwards, if you try to open the property page there are some follow-up errors like "Runtime-error -2147221164 (80040154) [Class not registered]" and "Automation error" without any additional information. A restart of the IDE is required to get things working again.

    If you were to save the project after having properly added an image or two to the ImageList controls and try to re-use the property page, all the saved images are lost.

    This procedure just works with the original ImageList.

  5. #85

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,108

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Caine View Post
    First of all, thank you very much for your efforts, Krool. Your controls work very reliably and I use them quite often these days.

    I do have an issue with ImageLists and property pages, though. Here's how to reproduce:

    1. Create a new project and add a reference to VBCCR17
    2. Add two image list controls to a form
    3. Open the property page and add an image
    4. Now, without closing the property page select the second image list and add an image
    5. Upon selecting an image the IDE produces a run-time error 0

    Afterwards, if you try to open the property page there are some follow-up errors like "Runtime-error -2147221164 (80040154) [Class not registered]" and "Automation error" without any additional information. A restart of the IDE is required to get things working again.

    If you were to save the project after having properly added an image or two to the ImageList controls and try to re-use the property page, all the saved images are lost.

    This procedure just works with the original ImageList.
    Solved/Fixed. Thanks

  6. #86
    New Member
    Join Date
    Jun 2021
    Location
    Germany
    Posts
    3

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Thank you Krool for this fantastic tool and excellent piece of work!

    I am missing the "UpTo" method of the RichTextBox component.

    If there are no plans to add it, then I will create in my code a function to do just that (InStr and SetStart).

  7. #87

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,108

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by clintc View Post
    Thank you Krool for this fantastic tool and excellent piece of work!

    I am missing the "UpTo" method of the RichTextBox component.

    If there are no plans to add it, then I will create in my code a function to do just that (InStr and SetStart).
    You can post the code here when you are sure it mimics 1:1 to what the MS RTB is doing. I could add this method to VBCCR17 without breaking compatibility...

  8. #88
    New Member
    Join Date
    Aug 2019
    Posts
    2

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    ....
    Last edited by wardjk; Sep 6th, 2021 at 04:59 PM. Reason: delete

  9. #89
    New Member
    Join Date
    Aug 2019
    Posts
    2

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by wardjk View Post
    I've been using VBCCR16.OCX and added VBCCR17.OCX in preparation of upgrading VBCCR16 controls to VBCCR17. The buttons in the VB6 IDE Toolbox for VBCCR17.OCX only show as black squares. The buttons for VBCCR16.OCX still show fine. I'm using VB6 (SP6) on Windows 10. The image shows the symptom. The VBCCR17 buttons are between the standard default buttons and those of VBCCR16. The inclusion of VBCCR16 in the project components does not affect the symptom and is included in the project of this image just for comparison. What can I do to make the buttons of VBCCR17 show the proper icons?
    Attachment 182259
    I'd delete this post if I could. I think I had a corrupted OCX. The buttons show fine with the replaced OCX.

  10. #90
    Addicted Member
    Join Date
    Jun 2017
    Posts
    229

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    .........
    Last edited by quickbbbb; Nov 9th, 2021 at 02:22 AM.

  11. #91
    Addicted Member
    Join Date
    Jun 2017
    Posts
    229

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    .......
    Last edited by quickbbbb; Nov 9th, 2021 at 02:22 AM.

  12. #92
    Junior Member
    Join Date
    Sep 2022
    Posts
    21

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Is there any documentation available appart from what you can get from the object browser?
    I have a problem with TextBoxW. If I assign a unicode string to the .Text property the non-Ansi characters are displayed as question marks. If I assign the same string to an unicode api MessageBoxW all the characters are displayed correctly. What am I doing wrong?

  13. #93
    Addicted Member
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    247

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by jpfa View Post
    I have a problem with TextBoxW. If I assign a unicode string to the .Text property the non-Ansi characters are displayed as question marks. If I assign the same string to an unicode api MessageBoxW all the characters are displayed correctly.
    Can you provide us a vb project with the TextBoxW and your unicode string so we can test this at our computer?

  14. #94
    Junior Member
    Join Date
    Sep 2022
    Posts
    21

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    It took a while to reduce my project to a small piece just to demonstrate the problem. Maybe it can be reduced even more, but I think this isn't too much code. I kept all the variables and functions involved names untouched. I deleted the unnecessary lines to make it more readable. (My complete project is huge).

    You must create a new project and add 2 references:
    Debug Object for AddressOf Subclassing (DbgWProc.dll)
    VB Common Controls Replacement 1.7 Library (VBCCR17.OCX)
    I assume you have these already registered.

    Add one form and set it to be the initial object.
    In the form place a TextBoxW control and name it TextBoxW1,
    and a CommandButton control and name it Command1.

    Add a module.

    Code for the form:
    Code:
    Option Explicit
    
    Private Declare Function MessageBox Lib "user32.dll" Alias "MessageBoxW" (ByVal hWnd As Long, ByVal lpText As Long, ByVal lpCaption As Long, ByVal wType As Long) As Long
    
    Private Sub MsgBoxW(ByVal Txt As String)
        MessageBox Me.hWnd, StrPtr(Txt), StrPtr("Title"), vbInformation
    End Sub
    
    Private Sub Command1_Click()
        Dim Japanese As String
    
        Japanese = ChrW(49) & ChrW(46) & ChrW(32) & ChrW(37329) & ChrW(30000) & ChrW(19968) & ChrW(32789) & ChrW(21161) & ChrW(12398) & ChrW(12486) & ChrW(12540) & ChrW(12510) & ChrW(32) & ChrW(40) & ChrW(84) & ChrW(104) & ChrW(101) & ChrW(109) & ChrW(101) & ChrW(32) & ChrW(79) & ChrW(102) & ChrW(32) & ChrW(75) & ChrW(111) & ChrW(104) & ChrW(115) & ChrW(117) & ChrW(107) & ChrW(101) & ChrW(32) & ChrW(75) & ChrW(105) & ChrW(110) & ChrW(100) & ChrW(97) & ChrW(105) & ChrW(99) & ChrW(104) & ChrW(105) & ChrW(41) & ChrW(46) & ChrW(109) & ChrW(112) & ChrW(51)
        TextBoxW1.Text = Japanese
        MsgBoxW Japanese
    End Sub
    
    Private Sub Form_Load()
        SubclassAll Me, False
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
        SubclassAll Me, True
    End Sub
    Code for the module:
    Code:
    Option Explicit
    
    Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long 'en la API "wParam As Long" está mal; debe ser ByVal "wParam As Integer"
    Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Public Const GWL_WNDPROC = -4
    
    Public DWPHookColl As New Collection
    Public lpPrevWndProcColl As New Collection
    
    Public Sub SubclassAll(FrmX As Form, ByVal UnSubclass As Boolean)
        Dim CtrlX As Control
        Dim hWnd As Long
        
        Subclass1 FrmX.hWnd, UnSubclass
        For Each CtrlX In FrmX.Controls
            hWnd = 0
            On Error Resume Next 'CtrlX may not have hWnd
            hWnd = CtrlX.hWnd
            On Error GoTo 0
            If hWnd <> 0 Then
                Subclass1 hWnd, UnSubclass
            End If
        Next
    End Sub
    
    Public Sub Subclass1(ByVal hWnd As Long, ByVal UnSubclass As Boolean)
        Dim lpPrevWndProc As Long
        Dim DWPHook As WindowProcHook
                
        If UnSubclass Then
            On Error Resume Next 'lpPrevWndProcColl(CStr(hWnd)) may not exist
                lpPrevWndProc = lpPrevWndProcColl(CStr(hWnd))
            On Error GoTo 0
            If lpPrevWndProc <> 0 Then
                SetWindowLong hWnd, GWL_WNDPROC, lpPrevWndProc
            End If
            On Error Resume Next
                DWPHookColl.Remove (CStr(hWnd)) 'indirectly free WindowProcHook
            On Error GoTo 0
        Else
            Set DWPHook = CreateWindowProcHook
            DWPHook.SetMainProc AddressOf WindowProc
            lpPrevWndProc = SetWindowLong(hWnd, GWL_WNDPROC, DWPHook.ProcAddress)
            DWPHook.SetDebugProc lpPrevWndProc
            DWPHookColl.Add DWPHook, CStr(hWnd)
            lpPrevWndProcColl.Add lpPrevWndProc, CStr(hWnd)
        End If
    End Sub
    
    Public Function WindowProc(ByVal hW As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
        Dim PrevWinProc As Long
        
        On Error Resume Next 'lpPrevWndProcColl(CStr(hWnd)) may not exist
        PrevWinProc = lpPrevWndProcColl(CStr(hW))
        On Error GoTo 0
        If PrevWinProc <> 0 Then
            WindowProc = CallWindowProc(PrevWinProc, hW, uMsg, wParam, lParam)
        End If
    End Function
    Run the program in the VB6 IDE.
    Click on the Command1 button.

    A unicode string will be assigned to the Text property of the TextBoxW1 control.
    In my environment (Windows XP sp3) the non-Ansi characters are displayed as question marks.

    Then the same string will be correctly displayed by the unicode API MessageBoxW function.

    Hope you'll be able to reproduce the problem. I suspect my system is the culprit; if that's the case you won't be able to reproduce it, I guess.

    Thanks for your help!

    Edit:
    If I don't subclass the TextBoxW control then the problem doesn't show, but that would mostly defeat the purpose of using a Text Box. I need to hook some of the messages (mostly the keystrokes and mouse messages). I didn't include this in the reduced code because the problem happens even if I don't preprocess the messages.
    Last edited by jpfa; Sep 8th, 2022 at 10:50 PM.

  15. #95
    Addicted Member
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    247

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by jpfa View Post
    If I don't subclass the TextBoxW control then the problem doesn't show, but that would mostly defeat the purpose of using a Text Box.
    You didnt wrote anything about "subclassing the textbox" at your first question. I guess Krool uses subclassing for the TextboxW too and this leads to problems...

  16. #96
    Junior Member
    Join Date
    Sep 2022
    Posts
    21

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Mith View Post
    You didnt wrote anything about "subclassing the textbox" at your first question.
    I didn't mention it in my first question because I didn't know this could have anything to do with the problem. It even didn't come to my mind immediatelly after stripping down my code and posting it. It came to my mind a little later; then I tried disabling the subclassing for just the TextBoxW and found that it indeed could be related to the problem. Then I edited my post to let you know about my new findings.

    Quote Originally Posted by Mith View Post
    I guess Krool uses subclassing for the TextboxW too and this leads to problems...
    Can you confirm that guess? Is the code showing the same behavior in your computer as it shows on mine?
    If so I'll assume that the control doesn't support subclassing and I'll have to take a different route (maybe using a different unicode text box).
    If not, then I'd like to know what's wrong with my code, if you can tell.
    But if it all works fine in your computer then I must assume that my system is to blame.

    Thanks for your help.

  17. #97
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,586

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    The source is available in this thread:
    https://www.vbforums.com/showthread....mmon-controls)

  18. #98
    Junior Member
    Join Date
    Sep 2022
    Posts
    21

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    That thread is huge! I wasn't able to spot the source code for TextBoxW at first sight, nor the search applet found it at specific posts(s) in the thread. Can you be more specific about which post # in the thread contains that source code?

  19. #99
    Addicted Member
    Join Date
    Jan 2012
    Posts
    176

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by jpfa View Post
    That thread is huge! I wasn't able to spot the source code for TextBoxW at first sight, nor the search applet found it at specific posts(s) in the thread. Can you be more specific about which post # in the thread contains that source code?
    I think you'll find links to the source code in post #1.

  20. #100
    Junior Member
    Join Date
    Sep 2022
    Posts
    21

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Erwin69 View Post
    I think you'll find links to the source code in post #1.
    If you mean OCX2StdExe v3.2.1.zip, that code just seems to build a standard exe that will have the controls in the ocx embedded so you don't have to distribute the VBCCR17.OCX file along with your executable. I couldn't make that run because of loading errors. Some files seem to be missing. Anyway I don't need to have the ocx embedded into my exe; I just use the ocx. (I'm not distributing this program at all, it's just for my personal use).

    ReadMe.docx contains instructions but not code.

  21. #101
    Fanatic Member
    Join Date
    Oct 2005
    Posts
    523

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Any idea how to make the MonthView control bigger? I tried changing the size the usual way by stretching the edges but it's locked at 2440 x 3030. I manually changed height and width but they changed right back. I changed the font - nothing. It seems to be stuck at one specific size. Any help would be appreciated.

  22. #102
    Fanatic Member
    Join Date
    Oct 2005
    Posts
    523

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Just thought I'd look at this project again since I'm having Mscomctl issues... and sadly when I download VBCCR17.OCX.RAR.ZIP and rename it to VBCCR17.OCX.RAR, WinRar reports it as damaged or incompatible and won't open it.

  23. #103

  24. #104
    Addicted Member
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    247

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Darkbob View Post
    ... and sadly when I download VBCCR17.OCX.RAR.ZIP and rename it to VBCCR17.OCX.RAR, WinRar reports it as damaged or incompatible and won't open it.
    I downloaded VBCCR17.OCX.RAR.ZIP, renamed it to VBCCR17.OCX.RAR and open it with WinRAR 5.21 (64bit) without any problems. I guess your file is corrupted and you have to redownload it.

  25. #105
    Addicted Member
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    247

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Darkbob View Post
    Any idea how to make the MonthView control bigger? I tried changing the size the usual way by stretching the edges but it's locked at 2440 x 3030.
    When the MonthView control is rendered using visual styles, its size just follows system settings and you cannot change its size.
    But you can disable visual styles and set a larger font to change the control size.
    Last edited by Mith; Feb 11th, 2023 at 09:48 PM.

  26. #106
    Junior Member
    Join Date
    Feb 2023
    Posts
    24

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Is the vbccr17 LARGEADDRESSAWARE?

    32bit exes are limited to 2GB address space.
    With the flag LARGEADDRESSAWARE this can be extended to 3GB (4GB?). (with editbin.exe /LARGEADDRESSAWARE myexe)
    But for this it must be able to handle pointers larger than &h7FFFFFFF.

    As long values are signed longs e.g.
    ptr = &h7FFFFFF0 + 32
    fails with overflow.
    When ptr is a pointer it then should have the value &h80000000 with is in dec -1

    Though to add an offset to a pointer for 3GB address space you need a e.g. subroutine to add an Offset:
    Function PointerAdd(ByVal base As Long, ByVal addthis As Long) As Long
    On Error Resume Next
    If Err.number Then Err.Clear
    base = base + addthis
    If Err.number Then
    base = base - &H40000000
    base = base - &H40000000
    base = base - &H40000000
    base = base + addthis
    base = base - &H40000000
    End If
    PointerAdd = base
    End Function

    With this
    ptr = PointerAdd(&h7FFFFFF0, 32)
    ptr will have the correct value &h80000000


    When no calculating with pointers is done and only VarPtr, StrPtr, ObjPtr are used to retrieve the addresses to pass it as argument to a function all is ok.
    Last edited by Chris_G33; Feb 28th, 2023 at 08:50 AM.

  27. #107

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,108

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Yes vbccr17 is LARGEADDRESSAWARE.
    UnsignedAdd/UnsignedSub is used everywhere..

  28. #108
    Junior Member
    Join Date
    Mar 2022
    Posts
    26

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Thanks for the cool controls!! I know it takes a lot of work to do this stuff...

    I had a few of questions:
    1. is it possible to add a "centered" option to LinkLabel?
    2. when the user clicks on the link, do I need to do something in code, or does the control handle this automatically? (perhaps I don't have something set correctly)
    3. I see there is a tool to "switch out" the OCX for the UC, but is there a tool to help automate the replacing of controls in an existing project/forms? I have lots of Labels, CommandButtons, Textboxes, etc. in my program and would like to try replacing these controls in each form, one by one, so I can test, test, test before I roll these out to my users.

    Again, Thanks for all the cool stuff and advice!

  29. #109

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,108

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by BooksRUs View Post
    1. is it possible to add a "centered" option to LinkLabel?
    2. when the user clicks on the link, do I need to do something in code, or does the control handle this automatically? (perhaps I don't have something set correctly)
    1. No. There is only left possible (by default) or right alignment via LWS_RIGHT. No centering possible.
    2. Yes, you shall take action with your code on the LinkActivate event.

  30. #110
    Junior Member
    Join Date
    Mar 2022
    Posts
    26

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    1. No. There is only left possible (by default) or right alignment via LWS_RIGHT. No centering possible.
    2. Yes, you shall take action with your code on the LinkActivate event.
    Thanks for the info... got it working. To fake centering it, I just added a bunch of spaces at the beginning to make it look centered on the form. Very weird that no vbCenter option, but I read the other posts concerning the same issue.

  31. #111
    Junior Member
    Join Date
    Mar 2022
    Posts
    26

    Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)

    A question about LabelW... it appears that ComCtl6 Textbox (but not Label) are multiple monitor "aware", in that ToolTips will appear on the *same* monitor just below the Textbox, but not the Label.

    It appears that LabelW suffers from the same behavior. Is there a way to make the LabelW tooltip to appear just below the LabelW on the SAME monitor?

    Thanks!!

Page 3 of 3 FirstFirst 123

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