Page 4 of 4 FirstFirst 1234
Results 121 to 147 of 147

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

  1. #121
    Member
    Join Date
    Sep 2022
    Posts
    40

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

    I can't find the OLEDragDrop event in the VBCCR17.RichTextBox (it's exposed in other VBCCR17 controls). There's instead a OLEDragDrop property that should enable the window as a OLE drop target but it doesn't actually do it here. What am I doing wrong? Or is there a workaround for this? If there is one, can anyone provide an example? Thanks !

    I'm running the VB6 Ide sp5 & 6 in a 64 bit Windows 10 OS.

  2. #122
    Hyperactive Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    445

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

    @jpfa

    You are right, some events are missing at Krool's Richtextbox control. Maybe Krool forgot to implement them?

    Microsoft Richtetxbox events:

    Code:
    Private Sub mS_RichTextBox_OLECompleteDrag(Effect As Long)
    Private Sub mS_RichTextBox_OLEDragDrop(Data As RichTextLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
    Private Sub mS_RichTextBox_OLEDragOver(Data As RichTextLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single, State As Integer)
    Private Sub mS_RichTextBox_OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean)
    Private Sub mS_RichTextBox_OLESetData(Data As RichTextLib.DataObject, DataFormat As Integer)
    Private Sub mS_RichTextBox_OLEStartDrag(Data As RichTextLib.DataObject, AllowedEffects As Long)
    VBCCR17 Richtextbox events:

    Code:
    Private Sub VBCCR_RichTextBox_OLECompleteDrag()
    Private Sub VBCCR_RichTextBox_OLEContextMenuClick(ByVal ID As Long)
    Private Sub VBCCR_RichTextBox_OLEDeleteObject(ByVal LpOleObject As Long)
    Private Sub VBCCR_RichTextBox_OLEGetContextMenu(ByVal SelType As Integer, ByVal LpOleObject As Long, ByVal SelStart As Long, ByVal SelEnd As Long, hMenu As Long)
    Private Sub VBCCR_RichTextBox_OLEGetDropEffect(Effect As Long, ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    Private Sub VBCCR_RichTextBox_OLEStartDrag(AllowedEffects As Long)

  3. #123
    Member
    Join Date
    Sep 2022
    Posts
    40

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

    For now I'm processing the clipboard myself like this, but it's not elegant. I'd like to use OLE events provided by the control itself.

    Code:
    Private WithEvents cIDT As cDropTarget
    
    Private Sub Form_Load()
        txtSrt.OLEDragDrop = False 
        Set cIDT = New cDropTarget
        cIDT.Attach txtSrt.hWnd
    End Sub
    
    Private Sub cIDT_Drop(pDataObj As oleexp.IDataObject, grfKeyState As Long, ptx As Long, pty As Long, pdwEffect As oleexp.DROPEFFECTS)
        Dim Fmt As FORMATETC
        Fmt.cfFormat = CF_HDROP
        Fmt.TYMED = TYMED_HGLOBAL
        Fmt.dwAspect = DVASPECT_CONTENT
        Fmt.lindex = -1
        
        Dim stg As STGMEDIUM
        
        If pDataObj.QueryGetData(Fmt) = S_OK Then
           pDataObj.GetData Fmt, stg
           Dim nFiles As Long, sFiles() As String
           Dim i As Long
           Dim sBuffer As String
           nFiles = DragQueryFileW(stg.data, &HFFFFFFFF, 0, 0)
           If nFiles > 0 Then
                ReDim sFiles(nFiles - 1)
                For i = 0 To nFiles - 1
                    SysReAllocStringLen VarPtr(sBuffer), , DragQueryFileW(stg.data, i)
                    DragQueryFileW stg.data, i, StrPtr(sBuffer), Len(sBuffer) + 1&
                    sFiles(i) = sBuffer
                Next
                TxtSrtDroppedFiles sFiles, ScaleY(ptx, vbPixels, vbTwips), grfKeyState, pdwEffect
           End If
        Else
           Debug.Print "failed querygetdata"
        End If
        pdwEffect = DROPEFFECT_NONE
    End Sub
    
    Private Sub TxtSrtDroppedFiles(Files() As String, ByVal y As Single, ByVal Shift As Long, Effect As oleexp.DROPEFFECTS)
        Dim FileName As Variant
        
            Effect = DROPEFFECT_COPY
            For Each FileName In Files
                MsgBoxW FileName
            Next
        DoEvents
    End Sub

  4. #124

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,371

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

    Quote Originally Posted by Mith View Post
    @jpfa

    You are right, some events are missing at Krool's Richtextbox control. Maybe Krool forgot to implement them?

    Microsoft Richtetxbox events:

    Code:
    Private Sub mS_RichTextBox_OLECompleteDrag(Effect As Long)
    Private Sub mS_RichTextBox_OLEDragDrop(Data As RichTextLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
    Private Sub mS_RichTextBox_OLEDragOver(Data As RichTextLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single, State As Integer)
    Private Sub mS_RichTextBox_OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean)
    Private Sub mS_RichTextBox_OLESetData(Data As RichTextLib.DataObject, DataFormat As Integer)
    Private Sub mS_RichTextBox_OLEStartDrag(Data As RichTextLib.DataObject, AllowedEffects As Long)
    VBCCR17 Richtextbox events:

    Code:
    Private Sub VBCCR_RichTextBox_OLECompleteDrag()
    Private Sub VBCCR_RichTextBox_OLEContextMenuClick(ByVal ID As Long)
    Private Sub VBCCR_RichTextBox_OLEDeleteObject(ByVal LpOleObject As Long)
    Private Sub VBCCR_RichTextBox_OLEGetContextMenu(ByVal SelType As Integer, ByVal LpOleObject As Long, ByVal SelStart As Long, ByVal SelEnd As Long, hMenu As Long)
    Private Sub VBCCR_RichTextBox_OLEGetDropEffect(Effect As Long, ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    Private Sub VBCCR_RichTextBox_OLEStartDrag(AllowedEffects As Long)
    True.
    OLEDragDrop is RichText specific.
    Will implement OLEDropMode and OLEDrag in 1.8. (Can be used if OLEDragDrop is False only for back-compat)

  5. #125
    Member
    Join Date
    Sep 2022
    Posts
    40

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

    Quote Originally Posted by Krool View Post
    True.
    OLEDragDrop is RichText specific.
    Will implement OLEDropMode and OLEDrag in 1.8. (Can be used if OLEDragDrop is False only for back-compat)
    Thanks, Krool!

  6. #126
    Hyperactive Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    445

    ComboBoxW text replacing bug

    I found a bug at the ComboBoxW control using the style "dropdowncombo", all other control properties are "Standard".

    I get different results for the text property when using this code:

    Code:
          cboMS.Text = "C:\test_"
          cboMS.AddItem "C:\test_1"
          cboMS.AddItem "C:\data"
    
          cboVBCCR.Text = "C:\test_"
          cboVBCCR.AddItem "C:\test_1"
          cboVBCCR.AddItem "C:\data"
    Name:  ComboBoxW.png
Views: 1079
Size:  8.9 KB

    The command .AddItem "C:\test_1" replaces the text "C:\test_" in the editbox!
    AddItem should extend the dropdown-list but not replace the text in the editbox.

    When i manually change the text in the editbox to "C:\test_" and open the dropdown-list the text will be changed back to "C:\test_1" again without clicking on the first item in the dropdown-list!

    Any idea how to get the same behavior as the original MS controls?
    Last edited by Mith; Dec 8th, 2023 at 11:54 PM.

  7. #127

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,371

    Re: ComboBoxW text replacing bug

    Quote Originally Posted by Mith View Post
    I found a bug at the ComboBoxW control using the style "dropdowncombo", all other control properties are "Standard".

    I get different results for the text property when using this code:

    Code:
          cboMS.Text = "C:\test_"
          cboMS.AddItem "C:\test_1"
          cboMS.AddItem "C:\data"
    
          cboVBCCR.Text = "C:\test_"
          cboVBCCR.AddItem "C:\test_1"
          cboVBCCR.AddItem "C:\data"
    Name:  ComboBoxW.png
Views: 1079
Size:  8.9 KB

    The command .AddItem "C:\test_1" replaces the text "C:\test_" in the editbox!
    AddItem should extend the dropdown-list but not replace the text in the editbox.

    When i manually change the text in the editbox to "C:\test_" and open the dropdown-list the text will be changed back to "C:\test_1" again without clicking on the first item in the dropdown-list!

    Any idea how to get the same behavior as the original MS controls?
    That's really strange.

    If you do
    Code:
        cboMS.Text = "C:\test_"
        cboMS.AddItem "C:\test_1"
        cboMS.AddItem "C:\data"
        cboMS.Width = cboMS.Width + 30
    You get the same behavior in the MS combo box.

    The problem is in the CheckDropDownHeight handler where MoveWindow is used..

    Workaround could be to block LB_FINDSTRING in the list windowproc during that MoveWindow.

    EDIT: Found a solution to use SetWindowPos on the list handle directly upon CheckDropDownHeight. Will roll out the fix release soon.
    Last edited by Krool; Dec 10th, 2023 at 08:04 AM.

  8. #128

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,371

    Re: ComboBoxW text replacing bug

    Quote Originally Posted by Mith View Post
    I found a bug at the ComboBoxW control using the style "dropdowncombo", all other control properties are "Standard".

    I get different results for the text property when using this code:

    Code:
          cboMS.Text = "C:\test_"
          cboMS.AddItem "C:\test_1"
          cboMS.AddItem "C:\data"
    
          cboVBCCR.Text = "C:\test_"
          cboVBCCR.AddItem "C:\test_1"
          cboVBCCR.AddItem "C:\data"
    Name:  ComboBoxW.png
Views: 1079
Size:  8.9 KB

    The command .AddItem "C:\test_1" replaces the text "C:\test_" in the editbox!
    AddItem should extend the dropdown-list but not replace the text in the editbox.

    When i manually change the text in the editbox to "C:\test_" and open the dropdown-list the text will be changed back to "C:\test_1" again without clicking on the first item in the dropdown-list!

    Any idea how to get the same behavior as the original MS controls?
    Update released. Fixed.

  9. #129
    Hyperactive Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    445

    Re: ComboBoxW text replacing bug

    Quote Originally Posted by Krool View Post
    Update released. Fixed.
    The problem with .AddItem is fixed with the new update.

    But when i open the dropdown-list the text still got replaced.

    It looks like after opening the drop-down list, some kind of "autocomplete" is triggered and the control searches all items for a match to the text and then replaces it.

    Any idea how to deactivate the auto-complete feature?

  10. #130

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,371

    Re: ComboBoxW text replacing bug

    Quote Originally Posted by Mith View Post
    The problem with .AddItem is fixed with the new update.

    But when i open the dropdown-list the text still got replaced.

    It looks like after opening the drop-down list, some kind of "autocomplete" is triggered and the control searches all items for a match to the text and then replaces it.

    Any idea how to deactivate the auto-complete feature?
    The MS control behaves the same. This "feature" can be deactivated by only blocking LB_FINDSTRING and returning -1.

  11. #131
    Hyperactive Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    445

    Re: ComboBoxW text replacing bug

    Quote Originally Posted by Krool View Post
    The MS control behaves the same. This "feature" can be deactivated by only blocking LB_FINDSTRING and returning -1.
    Is it possible for you to add a new "AutoComplete" property (true/false) for this case?

  12. #132
    Member
    Join Date
    Sep 2022
    Posts
    40

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

    I think I found another problem on the RichTextBox: the comands in the context menu Replace, Copy, Paste don't seem to support Unicode. Maybe the problem lies in my code. I'll perform more tests. Anyway, I think I can work around this issue by supplying a custom context menu instead of using the default one. However, it would be nice to have complete Unicode support provided natively by the control.

  13. #133
    Hyperactive Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    445

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

    Quote Originally Posted by jpfa View Post
    I think I found another problem on the RichTextBox: the comands in the context menu Replace, Copy, Paste don't seem to support Unicode.
    My RichTextBox doesnt have a context menu for Replace, Copy & Paste (Win10). I had to code my own context menu (with unicode support).

  14. #134
    Member
    Join Date
    Sep 2022
    Posts
    40

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

    Quote Originally Posted by Mith View Post
    My RichTextBox doesnt have a context menu for Replace, Copy & Paste (Win10). I had to code my own context menu (with unicode support).
    My version of VBCCR17.OCX is:
    Control ActiveX 1.7.0.44 VBCCR17 1.07.0044
    5,31 MB 30/08/202213:48

    Is yours rhe same?

  15. #135
    Hyperactive Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    445

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

    Quote Originally Posted by jpfa View Post
    My version of VBCCR17.OCX is:
    Control ActiveX 1.7.0.44 VBCCR17 1.07.0044
    5,31 MB 30/08/202213:48

    Is yours rhe same?
    My VBCCR version is 1.7.80.

    I only know that you can activate the property "Autoverbmenu" at the MS RichTextBox to get the system context menu.
    But the VBCCR RichTextBox doesnt have this property.
    How did you activate the context menu?

  16. #136
    Member
    Join Date
    Sep 2022
    Posts
    40

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

    Quote Originally Posted by Mith View Post
    How did you activate the context menu?
    I didn't do it on purpose and I can't seem to find anything in my code related to that behavior.
    This is an old project (maybe from 2008 or so) that I'm updating to support Unicode. Could it be that some hidden leftover from the old project is triggering it?

    I just started a new project to test this. I didn't write any code; just used the default main form and placed a VBCCR17.RichTextBox in it. I can confirm that it doesn't expose a context menu, just like you said. I don't have a clue about why.

    I guess I'll have to a lot more testing to shed some light over this mystery. Maybe you can give me some pointers?

    What I use to do in situations like this is to start a new project setting the components and references as used in the old project and copy all the code into it; then I see if the weird behavior is present here too. If it isn't and the Guids of the components are the same as in the old project, I'll be lost. If it is present then I comment out the code a piece at a time until the weird behavior desapears.

    This may take some time and I don't know if it's worth the effort. I may just implement a custom context menu, like you did. Speaking of which, if you're willing to share your code it will spare me some coding effort. I'd appreciate that. I planned to override the default menu anyway so to include some specialized commands in it.

  17. #137
    Hyperactive Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    445

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

    Quote Originally Posted by jpfa View Post
    I guess I'll have to a lot more testing to shed some light over this mystery. Maybe you can give me some pointers?
    check the mouse click events for some code to display a context menu.

    Quote Originally Posted by jpfa View Post
    Speaking of which, if you're willing to share your code it will spare me some coding effort.
    Sorry, i can't, because im using a commercial control for the context menu.

    Maybe useful for you: https://www.vbforums.com/showthread....dows-clipboard
    Last edited by Mith; Dec 11th, 2023 at 02:17 AM. Reason: added info link

  18. #138
    Member
    Join Date
    Sep 2022
    Posts
    40

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

    Quote Originally Posted by Mith View Post
    check the mouse click events for some code to display a context menu.[/url]
    Sure! Why didn't I do that first thing? That's what I usualy do. I must have been too sleepy last night.

    Quote Originally Posted by Mith View Post
    Sorry, i can't, because im using a commercial control for the context menu.
    [/url]
    That's totally fair. I'll post my code when I get it done.

    Quote Originally Posted by Mith View Post
    Sure! That's what I had planned to use. I'm already using part of that code for the Ole drag drop event replacement and it works as expected.

    Thanks for your help!

  19. #139
    Member
    Join Date
    Sep 2022
    Posts
    40

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

    Update:

    I found the bug in my code: I had already implemented a custom context menu that I was sure I wasn't using anymore but actually it was still active. That code didn't support Unicode.

    I just added Unicode support to it using https://www.vbforums.com/showthread....=1#post5067907 for the Clipboard and TextBoxW in the "Replace" form I already had instead of VB6 native TextBox. So I won't post my code because I didn't write any myself; it's all in the posted link.

    Thanks again Mith for your help!

  20. #140

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,371

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

    Quote Originally Posted by Mith View Post
    @jpfa

    You are right, some events are missing at Krool's Richtextbox control. Maybe Krool forgot to implement them?

    Microsoft Richtetxbox events:

    Code:
    Private Sub mS_RichTextBox_OLECompleteDrag(Effect As Long)
    Private Sub mS_RichTextBox_OLEDragDrop(Data As RichTextLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
    Private Sub mS_RichTextBox_OLEDragOver(Data As RichTextLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single, State As Integer)
    Private Sub mS_RichTextBox_OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean)
    Private Sub mS_RichTextBox_OLESetData(Data As RichTextLib.DataObject, DataFormat As Integer)
    Private Sub mS_RichTextBox_OLEStartDrag(Data As RichTextLib.DataObject, AllowedEffects As Long)
    VBCCR17 Richtextbox events:

    Code:
    Private Sub VBCCR_RichTextBox_OLECompleteDrag()
    Private Sub VBCCR_RichTextBox_OLEContextMenuClick(ByVal ID As Long)
    Private Sub VBCCR_RichTextBox_OLEDeleteObject(ByVal LpOleObject As Long)
    Private Sub VBCCR_RichTextBox_OLEGetContextMenu(ByVal SelType As Integer, ByVal LpOleObject As Long, ByVal SelStart As Long, ByVal SelEnd As Long, hMenu As Long)
    Private Sub VBCCR_RichTextBox_OLEGetDropEffect(Effect As Long, ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    Private Sub VBCCR_RichTextBox_OLEStartDrag(AllowedEffects As Long)
    The RichTextBox control is now updated. Can you check if everything is fine ? To note is that of course only the Std-EXE version is updated. The OCX will be updated in a year or so when more updates got accumulated.

  21. #141
    Member
    Join Date
    Sep 2022
    Posts
    40

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

    Thanks, Krool! It'll take some days to have time to test the update. Also I'm affraid my tests will be quite shallow (my coding skills are rather poor). So far I've only used the ocx control. I hope using the exe won't be hard and the debugger stepping into your subclassing can be avoided. Else my tests will be even more shallow. I wish somone else will join me in the testing.

    Meanwhile I had an issue with the Common Dialog replacement: the FileValidate event isn't firing. I just stumbled on this and didn't have time for further testing. This is most likely a bug in my code. I'll test the RichTextBox update first, though. The FileValidate issue can wait. Anyway this probably wouldn't help with what I wanted to achieve: to be able to accept an empty filename as valid (allowing the OK button to close the dialog even in this case).

  22. #142

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,371

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

    Quote Originally Posted by jpfa View Post
    Thanks, Krool! It'll take some days to have time to test the update. Also I'm affraid my tests will be quite shallow (my coding skills are rather poor). So far I've only used the ocx control. I hope using the exe won't be hard and the debugger stepping into your subclassing can be avoided. Else my tests will be even more shallow. I wish somone else will join me in the testing.

    Meanwhile I had an issue with the Common Dialog replacement: the FileValidate event isn't firing. I just stumbled on this and didn't have time for further testing. This is most likely a bug in my code. I'll test the RichTextBox update first, though. The FileValidate issue can wait. Anyway this probably wouldn't help with what I wanted to achieve: to be able to accept an empty filename as valid (allowing the OK button to close the dialog even in this case).
    MSDN
    The system sends this notification only if the dialog box was created using the OFN_EXPLORER value.
    Did you use CdlOFNExplorer in the .Flags property ?

  23. #143
    Member
    Join Date
    Sep 2022
    Posts
    40

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

    Thanks, Krool! I wasn't aware of that. That must be it. I didn't set the CdlOFNExplorer flag because I thought the new style was enabled by default. I didn't realize CdlOFNExplorer could have other effects. I still have so much to learn!

  24. #144
    New Member
    Join Date
    Oct 2023
    Posts
    1

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

    I have been reading thru the post, ( I have not got thru all of them yet), but was wondering if anybody knows if there is a replacement OCX for Media player. I have been scouring the internet, but have not found one yet. I have an Old program I wrote years ago that uses Media Player, and I would really love to get that program re going again.
    Thanks in advance,
    Susan Grant

  25. #145
    Member
    Join Date
    Sep 2022
    Posts
    40

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

    Quote Originally Posted by Krool View Post
    The RichTextBox control is now updated. Can you check if everything is fine ? To note is that of course only the Std-EXE version is updated. The OCX will be updated in a year or so when more updates got accumulated.
    I tested the updated ComCtlsDemo. The new events seem to work OK. It was a very shallow test; just added some Debug.Print to the events to display the values of the arguments and triggered the events.

    I didn't dare to add the source code to my projects. I'll wait for a new release of the OCX. Since I'm already using a workaround I may even skip some releases.

  26. #146
    Hyperactive Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    445

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

    Quote Originally Posted by grantsr1 View Post
    I have been reading thru the post, ( I have not got thru all of them yet), but was wondering if anybody knows if there is a replacement OCX for Media player. I have been scouring the internet, but have not found one yet. I have an Old program I wrote years ago that uses Media Player, and I would really love to get that program re going again.
    Thanks in advance,
    Susan Grant
    I still use the Windows Media Player in my project. Works from Win7 to Win11 including events.

    Example for late binding:

    Code:
    Private WithEvents xWMP As WMPLib.WindowsMediaPlayer
    Private MPlayer As VBControlExtender
    
    Set MPlayer = Controls.Add("WMPlayer.OCX.7", "MPlayer4")
    Set xWMP = MPlayer.Object

  27. #147
    Member
    Join Date
    Sep 2022
    Posts
    40

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

    Quote Originally Posted by jpfa
    Meanwhile I had an issue with the Common Dialog replacement: the FileValidate event isn't firing. I just stumbled on this and didn't have time for further testing. This is most likely a bug in my code. I'll test the RichTextBox update first, though. The FileValidate issue can wait. Anyway this probably wouldn't help with what I wanted to achieve: to be able to accept an empty filename as valid (allowing the OK button to close the dialog even in this case).
    Quote Originally Posted by Krool View Post
    MSDN
    Did you use CdlOFNExplorer in the .Flags property ?
    I did a few tests using CdlOFNExplorer in the .Flags property. None of the events were triggered. I did the tests on a barebones app in the Ide. I didn't test a compiled exe. I did the tests in 2 different machines both running Windows 10 22H2. Same results.

    So I switched to using the CmnDialogEx.cls class by LaVolpe in my projects. It behaves as expected and adds additional functionality which I already found useful.

    Anyway the CmnDialogEx.cls classdidn't help with what I wanted to achieve: to be able to accept an empty filename as valid (allowing the OK button to close the dialog even in this case). The DialogOnFileOk event isn't triggered if the filename is empty.

    I was able to device a workaround for an issue I had like forever: the file CommonDialog locks the last selected folder (even if I hit Cancel) forbiding me to delete it. This happens with all of the flavors of file CommonDialog I've tested (MS's, yours, LaVolpe's). The workaround is to select a different folder (I used App.Path) on a 2nd call to ShowOpen/ShowSave immediately after the first, and calling CloseDialog inside the DialogOnInit event of this 2nd call to ShowOpen/ShowSave. The dialog window flickers on this 2nd call, but this is just a small price to pay.

Page 4 of 4 FirstFirst 1234

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