dcsimg
Page 65 of 68 FirstFirst ... 155562636465666768 LastLast
Results 2,561 to 2,600 of 2688

Thread: CommonControls (Replacement of the MS common controls)

  1. #2561
    PowerPoster
    Join Date
    Feb 2017
    Posts
    2,103

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    It's the responsibility of the >>EXE<< to make such things. It would be ridicolous if an OCX overwrites VB functions without any control and with ASM hacks..
    What do you mean "without any control"?

    It works very well indeed.

    BTW: I updated the sample
    Last edited by Eduardo-; Feb 18th, 2020 at 01:30 AM.

  2. #2562

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

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Eduardo- View Post
    What do you mean "without any control"?

    It works very well indeed.

    BTW: I updated the sample
    It's NOT the job of the OCX to do that.

    Reapeating: It's the EXE responsibility to change fancy things.

    Quote Originally Posted by Darkbob View Post
    Well... that did change things. Now the whole IDE just closes and exits without any error message. But the demo still doesn't run.

    Just to make sure it wasn't just this new laptop I'm having troubles with I downloaded the demo and ran it on another computer. Identical result. Press Run and * poof * the IDE closes and exits. No error message. Just gone.

    Best of luck on what looks like a very powerful project with a lot of potential. I'll be sure to keep an eye on this thread and see what happens in future.
    Ok. Bye.
    Last edited by Krool; Feb 18th, 2020 at 01:55 AM.

  3. #2563
    PowerPoster
    Join Date
    Feb 2017
    Posts
    2,103

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    It's NOT the job of the OCX to do that.
    It is your component, you do whatever you want.

    But you cannot state it as a general rule, because it can be done and it works without problem.

    Quote Originally Posted by Krool View Post
    Reapeating: It's the EXE responsibility to change fancy things.
    Again, it is your opinion, your project, your decision.
    I thought it could be a good idea to offer that possibility, since your project mainly seems to be intended to upgrade VB6 bringing Unicode support to it (and other things), and leaving those intrinsic VB Functions in their ANSI version somewhat undermines the goal.
    I think for that reason you added them to the exe version.

    But if you are afraid that it could cause any problem, I understand.
    Or whatever reason that you have to think so.
    I just suggested it as a possibility, nothing more.
    I realize that you don't like contributions (or opinions).
    OK, no problem.

  4. #2564
    Addicted Member
    Join Date
    Jul 2017
    Posts
    208

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Darkbob View Post
    Last time I tried it the sample wouldn't load. I don't think they are really trying to make something people can use. Just tech types having fun I think.
    Try this . Add this manifest to your VB6.exe . I used ResourceHacker to update it .

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
      <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
          <application> 
            <!--This Id value indicates the application supports Windows Vista functionality -->
              <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> 
            <!--This Id value indicates the application supports Windows 7 functionality-->
              <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
            <!--This Id value indicates the application supports Windows 8 functionality-->
              <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
            <!--This Id value indicates the application supports Windows 8.1 functionality-->
              <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
          </application> 
      </compatibility>
      <assemblyIdentity type="win32" 
                        name="myOrganization.myDivision.mySampleApp" 
                        version="6.0.0.0" 
                        processorArchitecture="x86" 
                        publicKeyToken="0000000000000000"
      />
      <dependency>
        <dependentAssembly>
            <assemblyIdentity
                type="win32"
                name="Microsoft.Windows.Common-Controls"
                version="6.0.0.0"
                processorArchitecture="*"
                publicKeyToken="6595b64144ccf1df"
                language="*"
            />
        </dependentAssembly>
      </dependency>
      <application xmlns="urn:schemas-microsoft-com:asm.v3">
        <windowsSettings>
            <dpiAware  xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
        </windowsSettings>
      </application>  
    </assembly>
    I am using the OCX version , and I always combine the following files to the project > Most of them are oriented to visual styles issue .
    1- VisualStyles.bas
    2- Common.bas
    3- Resource file and following is its content :

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
      <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
          <application> 
            <!--This Id value indicates the application supports Windows 8 functionality-->
              <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
          </application> 
      </compatibility>
      <assemblyIdentity type="win32" 
                        name="myOrganization.myDivision.mySampleApp" 
                        version="6.0.0.0" 
                        processorArchitecture="x86" 
                        publicKeyToken="0000000000000000"
      />
      <dependency>
        <dependentAssembly>
            <assemblyIdentity
                type="win32"
                name="Microsoft.Windows.Common-Controls"
                version="6.0.0.0"
                processorArchitecture="*"
                publicKeyToken="6595b64144ccf1df"
                language="*"
            />
        </dependentAssembly>
      </dependency>
      <application xmlns="urn:schemas-microsoft-com:asm.v3">
        <windowsSettings>
            <dpiAware  xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
        </windowsSettings>
      </application>  
    </assembly>
    4- In each form_load event , add this line
    Code:
    SetupVisualStyles Me
    Last edited by Hosam AL Dein; Feb 18th, 2020 at 04:44 AM.

  5. #2565
    Hyperactive Member
    Join Date
    Oct 2005
    Posts
    376

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Hosam AL Dein View Post
    Try this . Add this manifest to your VB6.exe . I used ResourceHacker to update it .

    ...

    I am using the OCX version , and I always combine the following files to the project > Most of them are oriented to visual styles issue .
    1- VisualStyles.bas
    2- Common.bas
    3- Resource file and following is its content :
    First, thanks very much for your suggestions. Very helpful. I realize it's not your job to spoon feed me so I'll try to figure out how to add a manifest to VB6. Last time I tried... it didn't end well. But I'm up for another try. But any idea where a person would find VisualStyles.bas and Common.bas?

  6. #2566
    Addicted Member
    Join Date
    Jul 2017
    Posts
    208

    Re: CommonControls (Replacement of the MS common controls)

    Don`t mention it .
    But any idea where a person would find VisualStyles.bas and Common.bas?
    . Download the demo found in the first page of this thread . You will find them in the Common folder .

    Now you have the most recent version of VBCCR controls . The function SetupVisualStyles I mentioned above is updated to SetupVisualStylesFixes . (I have not yet upgraded to the latest version therefore I wrote the name I am still using) . See this post http://www.vbforums.com/showthread.p...=1#post5444619 .

    About Manifesting VB6 Exe , Download ResourceHacker . File > Open .. Browse for VB6.Exe > Open the Manifest node > delete all text > Paste the text provided above > Press the green arrow button Compile Script Then save it > Replace the old VB6.exe with this one . That`s it .

    Keep your old VB6.Exe in the same directory with another name in case of any failure . If you encountered permission error saving the new exe in this location , then save it in any other location then copy>paste it manually . Start IDE , you will notice that it is themed (If everything is ok) . One clear sign for that is you will not find any colors in the palette tab while setting the back color - (or any property dealing with colors) - property of any control from properties window .

  7. #2567
    PowerPoster
    Join Date
    Feb 2017
    Posts
    2,103

    Re: CommonControls (Replacement of the MS common controls)

    There is a bug in the LabelW control in the DoAutoSize procedure.

    The line:
    Code:
    .Extender.Move .Extender.Left, .Extender.Top, .ScaleX((CalcRect.Right - CalcRect.Left) + (BorderWidth * 2), vbPixels, vbContainerSize), .ScaleY((CalcRect.Bottom - CalcRect.Top) + (BorderHeight * 2), vbPixels, vbContainerSize)
    Should be changed to:
    Code:
    If PropWordWrap = True Then
        .Extender.Move .Extender.Left, .Extender.Top, .Extender.Width, .ScaleY((CalcRect.Bottom - CalcRect.Top) + (BorderHeight * 2), vbPixels, vbContainerSize)
    Else
        .Extender.Move .Extender.Left, .Extender.Top, .ScaleX((CalcRect.Right - CalcRect.Left) + (BorderWidth * 2), vbPixels, vbContainerSize), .ScaleY((CalcRect.Bottom - CalcRect.Top) + (BorderHeight * 2), vbPixels, vbContainerSize)
    End If

  8. #2568
    Hyperactive Member
    Join Date
    Oct 2005
    Posts
    376

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Hosam AL Dein View Post
    About Manifesting VB6 Exe , Download ResourceHacker . File > Open .. Browse for VB6.Exe > Open the Manifest node >
    Humm... No manifest node... Any ideas?

  9. #2569
    Addicted Member
    Join Date
    Jul 2017
    Posts
    208

    Re: CommonControls (Replacement of the MS common controls)

    Sorry , I produced the steps above by opening a manifested exe while in your case it is not . So , yes , you will not find this node as your exe is still not manifested yet .

    Anyway ,
    Action > Add from blank script > ((then a clean window opens - paste the manifest text in there )) > Compile green button > Save

  10. #2570
    Frenzied Member wqweto's Avatar
    Join Date
    May 2011
    Posts
    1,810

    Re: CommonControls (Replacement of the MS common controls)

    You don’t have to embed the manifest (I would advise against modifying vb6.exe in any way). Just place the .manifest file next to the .exe file and restart the OS. The last step is required for the manifest cache to be cleared and is usually not heeded and then someone declares in the forums external manifest is not working.

    You can clear the manifest cache for vb6.exe by changing its last modified date with touch.exe utility or similar too.

  11. #2571
    PowerPoster
    Join Date
    Feb 2017
    Posts
    2,103

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by wqweto View Post
    You don’t have to embed the manifest (I would advise against modifying vb6.exe in any way).
    Why?

  12. #2572
    Hyperactive Member
    Join Date
    Oct 2005
    Posts
    376

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Hosam AL Dein View Post
    Action > Add from blank script > ((then a clean window opens - paste the manifest text in there )) > Compile green button > Save
    Ah! Well.. that seems to work. But just a question... what does this all do?

    In my case I did notice the IDE showed a few minor changes to bold text but not much else.

    The only thing I noticed on my own existing VB project was that the background color for the drop-down combo box changed from green to light grey. Not sure why that would happen.

    Is there some benefit I'm not seeing? Or does the benefit only happen when you start using the replacement controls?

  13. #2573
    Hyperactive Member
    Join Date
    Oct 2005
    Posts
    376

    Re: CommonControls (Replacement of the MS common controls)

    OMG it works. The demo actually works!!! Hosan Al Dein showed the way with his brilliant post about adding a manifest into the VB6.EXE file... and presto. The demo finally works! Might be an idea to edit post #1 and add this info. Now I can finally see what you guys are talking about.

    Name:  working.jpg
Views: 230
Size:  32.2 KB
    Last edited by Darkbob; Feb 19th, 2020 at 11:29 AM.

  14. #2574
    Frenzied Member wqweto's Avatar
    Join Date
    May 2011
    Posts
    1,810

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Eduardo- View Post
    Why?
    Because it's not needed. Why would I want to modify the compiler just to run the IDE manifested if I don't have to?

    Of course vb6.exe is not digitally signed nor is it a protected OS file so there are no "defenses" against corrupting it yourself at will.

    Why does Resource Hacker always create a backup file next to the modified executable? Obviously fiddling w/ PE files this is not as reliable as adding/removing "resources" to a .zip file -- never seen 7-zip creating backup files when modifying an archive.

    cheers,
    </wqw>

  15. #2575
    Member dseaman's Avatar
    Join Date
    Oct 2004
    Location
    Natal, Brazil
    Posts
    33

    Re: CommonControls (Replacement of the MS common controls)

    Several years ago I used an embedded Vb6.exe Manifest until I managed to corrupt Vb6 after a fresh install of Windows.
    Since then I always use an external Manifest "Vb6.exe.manifest".
    I did have to make a registry change so that it is recognized.

    Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide
    Value(REG_DWORD): PreferExternalManifest
    Data: 1 = prefer, 0 = don't prefer

  16. #2576
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    6,106

    Re: CommonControls (Replacement of the MS common controls)

    --

    A .Refresh on the status bar wipes out the text. That doesn't seem correct.

    I'm just using it as a single StatusBar, and using the SimpleText property.

    I'm also using the source code version, and just including it in my project.

    Here's the code I originally had:

    Code:
    
    Public Sub UndoChanges()
        ' Careful, FilePath and FileName shouldn't be undone.
        '
    
    
        If miUndoCount = 0& Then
            SetStatus "There are no remaining undo points."
            Sleep 200
            SetStatus "There are no remaining undo points."
            Sleep 200
            SetStatus "There are no remaining undo points."
            Sleep 200
            SetStatus "There are no remaining undo points."
            Exit Sub
        End If
        '
    
    
    
    
    End Sub
    
    
    
    
    Public Sub SetStatus(sText As String):
        StatusBar.SimpleText = " " & sText
        StatusBar.Refresh
    End Sub
    
    

    I just wanted it to blink a bit.

    If I comment out the StatusBar.Refresh line, the text doesn't get cleared, but I don't get my blink.

    -----

    Actually, I was hoping for a .ForeColor (or maybe .FontColor), so I could blink it red, but that wasn't an easy option.

    But I suspect, even with that, I'd still have a problem making it blink, which I want.

    --------

    EDIT1: Ok, I was being a bit dense. I needed something like the following to get my blink.

    Code:
    
        If miUndoCount = 0& Then
            SetStatus "There are no remaining undo points."
            Sleep 200
            SetStatus vbNullString
            Sleep 200
            SetStatus "There are no remaining undo points."
            Sleep 200
            SetStatus vbNullString
            Sleep 200
            SetStatus "There are no remaining undo points."
            Sleep 200
            SetStatus vbNullString
            Sleep 200
            SetStatus "There are no remaining undo points."
            Sleep 200
            SetStatus vbNullString
            Sleep 200
            SetStatus "There are no remaining undo points."
            Exit Sub
        End If
    
    
    And that actually worked, blink and all.

    I think my question still stands though. A .Refresh is suppose to clear the text?
    Last edited by Elroy; Feb 19th, 2020 at 02:46 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.

  17. #2577
    Frenzied Member wqweto's Avatar
    Join Date
    May 2011
    Posts
    1,810

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by dseaman View Post
    I did have to make a registry change so that it is recognized.
    My point exactly: *this* is the kind of cargo-culting in this thread that my duty called. . .



    No need to change this reg key. Just create the the vb6.exe.manifest and then restart the OS :-))

    cheers,
    </wqw>

  18. #2578

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

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Elroy View Post
    Actually, I was hoping for a .ForeColor (or maybe .FontColor), so I could blink it red, but that wasn't an easy option.

    I think my question still stands though. A .Refresh is suppose to clear the text?
    When using .Style = Normal you can use the .Panels(Index).ForeColor property.

    A .Refresh should erase the text? I can't replicate such thing.

    Quote Originally Posted by Eduardo- View Post
    There is a bug in the LabelW control in the DoAutoSize procedure.
    Thanks, your right. Update released.

    Quote Originally Posted by Darkbob View Post
    OMG it works. The demo actually works!!! Hosan Al Dein showed the way with his brilliant post about adding a manifest into the VB6.EXE file... and presto. The demo finally works! Might be an idea to edit post #1 and add this info. Now I can finally see what you guys are talking about.

    Name:  working.jpg
Views: 230
Size:  32.2 KB
    The demo should also works without manifest. At least it does for me.

    Name:  ComCtlsDemoNoManifest.jpg
Views: 231
Size:  55.1 KB

  19. #2579
    PowerPoster
    Join Date
    Feb 2017
    Posts
    2,103

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by wqweto View Post
    Because it's not needed. Why would I want to modify the compiler just to run the IDE manifested if I don't have to?

    Of course vb6.exe is not digitally signed nor is it a protected OS file so there are no "defenses" against corrupting it yourself at will.

    Why does Resource Hacker always create a backup file next to the modified executable? Obviously fiddling w/ PE files this is not as reliable as adding/removing "resources" to a .zip file -- never seen 7-zip creating backup files when modifying an archive.

    cheers,
    </wqw>
    OK, I just asked to know if there was an issue I wasn't aware about.

  20. #2580
    Addicted Member
    Join Date
    Jul 2017
    Posts
    208

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Darkbob View Post
    OMG it works. The demo actually works!!! Hosan Al Dein showed the way with his brilliant post about adding a manifest into the VB6.EXE file... and presto. The demo finally works! Might be an idea to edit post #1 and add this info. Now I can finally see what you guys are talking about.
    Really glad to help , Darkbob .

    Is there some benefit I'm not seeing? Or does the benefit only happen when you start using the replacement controls?
    The benefit is you can see visual styles applied to the controls in design time . So , As Krool mentioned , you can still ignore this option and you will see visual styles applied after you compile your project (not in design time) if you did one of the following : 1 - you have a manifest embedded in your resource file 2 - you provide external manifest to your exe .

    This is a general rule that has nothing to do with VBCCR controls . But why is it around here in VBCCR ? because VBCCR support visual styles . So , we add this manifest to see this effect . Adding manifest to vb6.exe or your exe is optional unless you use some VBCCR features which require a manifest that supports Common Controls 6 or higher .

    So to conclude , Manifests do many things . One of them is to provide visual styles ability .
    You can use them externally by adding the manifest text in an external file with the same name as your exe and with .Manifest extension and some tweaks in your OS . Or you can use them embedded in your exe like what you have done in your vb6.exe .

    Why did we add a resource file to the project ? Because we need this manifest to be compiled with the exe .

    I hope I could make it clear for you as English is not my first language . Have a nice day .

    Edit 1:
    Some posts are ignored in my reply .
    Edit 2:
    This post does not answer the question that you may ask : Why did this manifest solved the problem if its only purpose in this project is to see visual styles effects in design time ?
    I can guess an answer but still not pretty sure about it .
    Last edited by Hosam AL Dein; Feb 20th, 2020 at 01:58 AM.

  21. #2581

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

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Eduardo- View Post
    There is a bug in the LabelW control in the DoAutoSize procedure.

    The line:
    Code:
    .Extender.Move .Extender.Left, .Extender.Top, .ScaleX((CalcRect.Right - CalcRect.Left) + (BorderWidth * 2), vbPixels, vbContainerSize), .ScaleY((CalcRect.Bottom - CalcRect.Top) + (BorderHeight * 2), vbPixels, vbContainerSize)
    Should be changed to:
    Code:
    If PropWordWrap = True Then
        .Extender.Move .Extender.Left, .Extender.Top, .Extender.Width, .ScaleY((CalcRect.Bottom - CalcRect.Top) + (BorderHeight * 2), vbPixels, vbContainerSize)
    Else
        .Extender.Move .Extender.Left, .Extender.Top, .ScaleX((CalcRect.Right - CalcRect.Left) + (BorderWidth * 2), vbPixels, vbContainerSize), .ScaleY((CalcRect.Bottom - CalcRect.Top) + (BorderHeight * 2), vbPixels, vbContainerSize)
    End If
    Hi Eduardo,

    I updated yesterday your suggested bugfix. However, I think the behavior is now not really correct.

    E.g. make a LabelW1.Caption = "test" with a Width of 255 and WordWrap = True and AutoSize = True.
    Now change the Caption to "test_added". The VB.Label autosize the width while now the LabelW doesn't.

    My proposed solution would be:
    Code:
    If PropWordWrap = True Then
        .Extender.Height = .ScaleY((CalcRect.Bottom - CalcRect.Top) + (BorderHeight * 2), vbPixels, vbContainerSize)
        If .ScaleWidth < ((CalcRect.Right - CalcRect.Left) + (BorderWidth * 2)) Then .Extender.Width = .ScaleX((CalcRect.Right - CalcRect.Left) + (BorderWidth * 2), vbPixels, vbContainerSize)
    Else
        .Extender.Move .Extender.Left, .Extender.Top, .ScaleX((CalcRect.Right - CalcRect.Left) + (BorderWidth * 2), vbPixels, vbContainerSize), .ScaleY((CalcRect.Bottom - CalcRect.Top) + (BorderHeight * 2), vbPixels, vbContainerSize)
    End If
    Can you confirm before I update another bugfix?

  22. #2582
    PowerPoster
    Join Date
    Feb 2017
    Posts
    2,103

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    Hi Eduardo,

    I updated yesterday your suggested bugfix. However, I think the behavior is now not really correct.

    E.g. make a LabelW1.Caption = "test" with a Width of 255 and WordWrap = True and AutoSize = True.
    Now change the Caption to "test_added". The VB.Label autosize the width while now the LabelW doesn't.

    My proposed solution would be:
    Code:
    If PropWordWrap = True Then
        .Extender.Height = .ScaleY((CalcRect.Bottom - CalcRect.Top) + (BorderHeight * 2), vbPixels, vbContainerSize)
        If .ScaleWidth < ((CalcRect.Right - CalcRect.Left) + (BorderWidth * 2)) Then .Extender.Width = .ScaleX((CalcRect.Right - CalcRect.Left) + (BorderWidth * 2), vbPixels, vbContainerSize)
    Else
        .Extender.Move .Extender.Left, .Extender.Top, .ScaleX((CalcRect.Right - CalcRect.Left) + (BorderWidth * 2), vbPixels, vbContainerSize), .ScaleY((CalcRect.Bottom - CalcRect.Top) + (BorderHeight * 2), vbPixels, vbContainerSize)
    End If
    Can you confirm before I update another bugfix?
    Yes, you are right. When its width is smaller than any of the individual words, it extends the width to that.
    I performed some testing with your new code and it seems to make it work as the original.

  23. #2583

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

    Re: CommonControls (Replacement of the MS common controls)

    Update released.

    Thanks Eduardo.

    I fiddled also now again a while with the LabelW AutoSize in comparison to VB.Label with the WordWrap and my previously suggested version works in all scenarios. (slightly modified to cause only 1 resize)
    Code:
    If PropWordWrap = True Then
        If .ScaleWidth < ((CalcRect.Right - CalcRect.Left) + (BorderWidth * 2)) Then
            .Extender.Move .Extender.Left, .Extender.Top, .ScaleX((CalcRect.Right - CalcRect.Left) + (BorderWidth * 2), vbPixels, vbContainerSize), .ScaleY((CalcRect.Bottom - CalcRect.Top) + (BorderHeight * 2), vbPixels, vbContainerSize)
        Else
            .Extender.Height = .ScaleY((CalcRect.Bottom - CalcRect.Top) + (BorderHeight * 2), vbPixels, vbContainerSize)
        End If
    Else
        .Extender.Move .Extender.Left, .Extender.Top, .ScaleX((CalcRect.Right - CalcRect.Left) + (BorderWidth * 2), vbPixels, vbContainerSize), .ScaleY((CalcRect.Bottom - CalcRect.Top) + (BorderHeight * 2), vbPixels, vbContainerSize)
    End If

  24. #2584
    PowerPoster
    Join Date
    Feb 2017
    Posts
    2,103

    Re: CommonControls (Replacement of the MS common controls)


  25. #2585
    New Member
    Join Date
    Feb 2020
    Posts
    2

    Re: CommonControls (Replacement of the MS common controls)

    Latest ComCtlsDemo.zip of 20/20/2020 can't start (F5 or Ctrl-F5) and throws the error "To use this functionality, you must provide a manifest specifying comctl32.dll version 6.0 or higher." Note that I have the themes service on XP machine disable because I don't use any theme. How to add the manifest in the project to be able to step through?
    Although It makes the exe form the make File->Make ComCtlsDemo.exe and all the controls appear to work the RichTextBox Demo button just ends (or crash) the executable without any clue. The OLEGuids are in system32.

  26. #2586

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

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by travma View Post
    Latest ComCtlsDemo.zip of 20/20/2020 can't start (F5 or Ctrl-F5) and throws the error "To use this functionality, you must provide a manifest specifying comctl32.dll version 6.0 or higher." Note that I have the themes service on XP machine disable because I don't use any theme. How to add the manifest in the project to be able to step through?
    Although It makes the exe form the make File->Make ComCtlsDemo.exe and all the controls appear to work the RichTextBox Demo button just ends (or crash) the executable without any clue. The OLEGuids are in system32.
    If youwould read the notes in the first thread you would know to make following setting;

    Goto menu Tools -> Options... -> General -> Error Trapping.
    "Break on Unhandled Errors" should be selected instead of "Break in Class Module".

    This is some odd default setting of VB6 which I can't do something about. However, it's a one-time change in settings and then OK for the end of life of that installation.

  27. #2587
    Hyperactive Member
    Join Date
    Oct 2005
    Posts
    376

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Hosam AL Dein View Post
    I hope I could make it clear for you as English is not my first language
    Your post was far clearer than any of the other posts from the experts. I think you speak well in my native tongue - nOOb!

    Thanks very much again for your help!

  28. #2588
    Hyperactive Member
    Join Date
    Oct 2005
    Posts
    376

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by travma View Post
    Latest ComCtlsDemo.zip of 20/20/2020 can't start (F5 or Ctrl-F5) and throws the error "To use this functionality, you must provide a manifest specifying comctl32.dll version 6.0 or higher." Note that I have the themes service on XP machine disable because I don't use any theme. How to add the manifest in the project to be able to step through?
    Although It makes the exe form the make File->Make ComCtlsDemo.exe and all the controls appear to work the RichTextBox Demo button just ends (or crash) the executable without any clue. The OLEGuids are in system32.
    You ran into the same problem I found. The demo simply doesn't work. But don't give up - it's a great project and you CAN make it run. There are a bunch of steps you need to take to get it working but the most important is to put a manifest right inside the VB6.EXE. You would think they would maybe mention that somewhere in bold letters in the first post wouldn't you? The details are buried deep in this thread if you dig hard enough. Take a look at posts on Page 64 by Hosam AL Dein.

  29. #2589
    New Member
    Join Date
    Feb 2020
    Posts
    2

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Darkbob View Post
    You ran into the same problem I found. The demo simply doesn't work. But don't give up - it's a great project and you CAN make it run. There are a bunch of steps you need to take to get it working but the most important is to put a manifest right inside the VB6.EXE. You would think they would maybe mention that somewhere in bold letters in the first post wouldn't you? The details are buried deep in this thread if you dig hard enough. Take a look at posts on Page 64 by Hosam AL Dein.
    On searching to resolve the "manifest thing" I add a manifest to the vb.exe with some manifester tool I had found there but then again the "manifest error" doesn't go away and because I didn't think that it was relevant to VB options I was never go to change that option mention in the 1st post. Now, thanks to Krool it was resolved, and I guess that I need to carefully look here again to find out why the error 383 on Form_load event raised on FontCombo1.Text = RichTextBox1.SelFontName which VB complain is "Property is read only" when I hit the RichTextBox Demo button. Anyway I never use the RichTextBox. I was searching on listview thinking that control has multiline/wrap ability (vbCrLf kind of stuff) when I realize the listbox and later listview doesn't have that feature and the rows are always one-liners only.
    Any help to that matter is welcome as the code structure will stay as intended eg. loop to fill listview with multi-line text in its rows. The single textbox (which seems the only option for me now) doesn't need to attach to a loop to fill with stuff, as the user can click inside another listbox\listview control to see his selection "magnified" in this textbox. But this click-to-see user experience is not what I think.

  30. #2590

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

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by dseaman View Post
    If you sort your controls alphanumeric in the Vbp file they will appear sorted in the ToolBox.
    Actually, I usually sort the entire block containing Modules/Classes/Controls/PropertyPages to make the Vbp more readable.
    Makes sense. Thanks.
    I sorted now the vbp file for the ComCtlsDemo. The next VBCCR17 will be then sorted likewise.

  31. #2591

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

    Re: CommonControls (Replacement of the MS common controls)

    With today's update the sync between Std-EXE and OCX version is broken.

    It's intended to be. It's necessary to fix some problems and also an opportunity to include new features or to solve deficits.

    So when somebody has a wish, now it's the time.

    The idea is to bring everything in order so in a few weeks/months VBCCR17 can be released.
    Also then when a (maybe final?) VBCCR17 is then released I could spent some time to make a documentation..
    Last edited by Krool; Feb 25th, 2020 at 02:59 PM.

  32. #2592
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    6,106

    Re: CommonControls (Replacement of the MS common controls)

    Vertical Slider that will truly reverse.

    ---------

    Also, I've been neglecting to bring this up because it'd probably take quite a bit to isolate the problem, but I'm having some kind of a timing issue. Also, it's probably not a problem in the OCX version, but I don't know, as I've got your Slider, TreeView, and StatusBar source code just included in my project.

    But basically, under some strange circumstances, it's cycling through the certain controls on a form, causing them to fire GotFocus and LostFocus events, which was giving me a big problem. It's happening after certain forms get loaded, and even after the completion of my Sub Main procedure ... but before the user actually does anything. In other words, it's as if something about the VBCCR is "settling down" and firing those GotFocus and LostFocus events.

    The control that was giving me the most problem was NOT the first of the TabIndex order. I checked that thoroughly. I also checked to make sure that nothing I did was setting the focus of that control, and nothing is. And it's definitely before the user does anything. I'll admit that I didn't check to see if it was both a compiled and IDE problem. I was getting the problem in the IDE (while running) ... no problems in design mode. Also, just as a further FYI, as I jiggle the design of the form, the problem control moves around to different controls.

    Here's how I fixed it. First, I created a global variable:

    Code:
    
    Public gbStarting               As Boolean              ' Just used during program startup to give a few milliseconds to let things settle down.
    
    
    And then, I put my own timer on the primary form. I pre-set it to Enabled=True and Interval=500.

    And then, I put this in the timer's event, which just executes once:

    Code:
    
    Private Sub TimerStartup_Timer()
        ' This just fixes some weird startup thing where a random control gets the focus, which may mess things up.
        ' I believe it has something to do with Krool's controls.
        '
        TimerStartup.Enabled = False
        gbStarting = False
    End Sub
    
    
    And then, in a few critical places, I checked the gbStarting global, and just did an Exit Sub if it was true.

    Without releasing the thread, I couldn't find a way to solve the problem. Also, just as a further FYI, I tried tracing back from the GotFocus event, and it immediately went into some of your code in the ComCtlsBase.bas module. Let me turn off the timer and see if I can get the error again. ... Well drat, I can't reproduce it at the moment. That was quite a few versions back (of MY program) that I was getting it and implemented that above fix.

    Other than deleting the property pages in the Slider, TreeView, and StatusBar controls, I'm using your code perfectly unchanged. I've got the following modules of yours in my project:

    • ISubclass.cls
    • Common.bas
    • ComCtlsBase.bas
    • VisualStyles.bas
    • VTableHandle.bas
    • Slider.ctl/ctx
    • StatusBar.ctl/ctx
    • TreeView.ctl/ctx
    • TvwNode.cls
    • TvwNodes.cls
    • SbrPanel.cls
    • SbrPanels.cls
    • SbrPanelProperties.cls

    -----

    I'm good, but, since you asked for stuff, I thought I'd outline it for you.

    Elroy
    Last edited by Elroy; Feb 25th, 2020 at 06:49 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.

  33. #2593
    Lively Member
    Join Date
    Feb 2015
    Location
    Colorado USA
    Posts
    113

    Re: CommonControls (Replacement of the MS common controls)

    Krool,

    Is it time to fold VBFlexGrid into the forthcoming VBCCR17?

  34. #2594
    Hyperactive Member
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    510

    Re: CommonControls (Replacement of the MS common controls)

    Krool, as per my previous request, which I think you haven't yet seen...

    http://www.vbforums.com/showthread.p...=1#post5453057

    Add Horiz. & Vert. Skroolbars to the CommonControls Collection

  35. #2595
    Hyperactive Member
    Join Date
    Apr 2015
    Posts
    466

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    So when somebody has a wish, now it's the time.
    Not easy to enhance a perfect thing!

    Unsorted and perhaps unrealistic:

    -a- unified tooltip appearance
    -b- full control over the colors in order to get a dark mode
    -c- a menu control that can show icons
    -d- all existing controls with a horizontal scrollbar shall react to the wheel when mouse is over it

    To a:
    AFAIK in the works from time time.

    To b:
    I know comctl32 doesn't offer a dark mode.
    Maybe it is somehow possible anyway?

    To c:
    I know there are some solutions around.
    And I use one of them, but it's cumbersome to work with it.
    Not nearly the quality as VBCCR.

    To d:
    Paint.net has this feature, and I think it is a clever idea.


    My $0.02

  36. #2596

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

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by yereverluvinuncleber View Post
    Krool, as per my previous request, which I think you haven't yet seen...

    http://www.vbforums.com/showthread.p...=1#post5453057

    Add Horiz. & Vert. Skroolbars to the CommonControls Collection
    I read it but ignored it. There are 2 types of scrollbars.
    1. Encapsulated with in an independent hWnd
    2. Embedded in a control, same hWnd as control. (NC area)

    So making a type 1 scrollbar like VB.scrollbar won't make a difference without hooks/subclasses.
    And my aim is to avoid hooks whereever possible and not to subclass "beyond the UC border".
    So the answer tends to say: no.

    Quote Originally Posted by MountainMan View Post
    Is it time to fold VBFlexGrid into the forthcoming VBCCR17?
    Think not. The VBFlexGrid might be developed further after VBCCR17. When it's separated then the development can be independent.

  37. #2597
    Addicted Member
    Join Date
    Jul 2016
    Posts
    141

    Re: CommonControls (Replacement of the MS common controls)

    How do you repaint a CommandButtonW's picture with a vertical offset?

    Before using VBCCR, I made custom graphical buttons by creating a PictureBox (which I call PictureBtn), setting PictureBox.Picture to a GIF, and setting the size of the PictureBox to half the height of the GIF. The GIF contains two versions of an image stacked vertically: the top one is the image in a normal state, and the bottom one is a darker version of itself. The idea is that when you hover the mouse over the button, the picture changes to the darker version, to convey the hover effect.
    Name:  circle-dollar-large.gif
Views: 101
Size:  4.3 KB

    To do that, on PictureBox_MouseMove I would PaintPicture with the vertical offset Y1 set to -128, but there is no MouseLeave event for the PictureBox so I would work around that by using Frame_MouseMove and PaintPicture with the PictureBox's vertical offset Y1 set to 0:

    Code:
    Private Sub PictureBtn_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
        PictureBtn(Index).PaintPicture PictureBtn(Index).Picture, 0, -128
    End Sub
    
    Private Sub Frame_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
        Dim pb As PictureBox
    
        For Each pb In PictureBtn
            pb.PaintPicture pb.Picture, 0, 0
        Next
    End Sub
    But using Frame_MouseMove is unreliable, since the mouse might not move onto the frame but onto some other control.

    VBCCR's CommandButtonW has the MouseEnter and MouseLeave events, great. I created a CommandButtonW with Style=vbButtonGraphical and the Picture set to the same GIF as above. However, the picture is centered vertically, so this is what I see:
    Name:  screenshot_20200226_175131.png
Views: 101
Size:  4.7 KB

    I tried changing CommandButtonW.VerticalAlignment but it seems to have no effect on the picture or on the caption.

    Using Windows XP SP3.

    How do I repaint the picture with Y=0, and with Y=-128?

    I see there is CommandButtonW.Picture.Render but no luck figuring out how to use that yet.

  38. #2598
    Addicted Member
    Join Date
    Jul 2016
    Posts
    141

    Re: CommonControls (Replacement of the MS common controls)

    Well, I managed to redraw the picture using this:

    Code:
    Private Sub RoundButtons_MouseEnter(Index As Integer)
        With RoundButtons(Index).Picture
            .Render GetDC(RoundButtons(Index).hwnd), 0, 0, 128, 256, _
                 0, .Height / 2, .Width, -.Height, 0
        End With
    End Sub
    
    Private Sub RoundButtons_MouseLeave(Index As Integer)
        With RoundButtons(Index).Picture
            .Render GetDC(RoundButtons(Index).hwnd), 0, 0, 128, 256, _
                 0&, .Height, .Width, -.Height, ByVal 0&
        End With
    End Sub
    However, the picture is still vertically centered (i.e. looks wrong) when the form is loaded, and only gets "fixed" once I mouse-over. I tried calling the RoundButtons_MouseLeave routine to re-render the picture from Form_Activate (it's an MDI child form) but when the form appears the button is still wrong. I tried calling it from Form_Paint, but for some reason the form paint event never fires. And even if I mouse-over the button (which makes it look correct, the picture gets set to y=0), then it gets re-centered (i.e. broken) if I switch to a different window and then switch back to my program.
    Last edited by OldClock; Feb 26th, 2020 at 01:08 PM.

  39. #2599

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

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by OldClock View Post
    How do you repaint a CommandButtonW's picture with a vertical offset?
    Why making it so complicated? And why this problem should be solved in CommandButtonW? Next time somebody comes with an horizontal offset, or diagonal...

    Instead use a paint program and split your picture in two pieces and put the normal picture in PictureBox1 and the hover picture in PictureBox2 and just make:

    Code:
    Private Sub CommandButtonW1_MouseEnter()
    Set CommandButtonW1.Picture = Picture1.Picture
    End Sub
    
    Private Sub CommandButtonW1_MouseLeave()
    Set CommandButtonW1.Picture = Picture2.Picture
    End Sub

  40. #2600

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

    Re: CommonControls (Replacement of the MS common controls)

    TreeView control is now 'Alignable'.
    This enables it now to be placed on MDIForms, for example as a 'menu tree' style control.

Page 65 of 68 FirstFirst ... 155562636465666768 LastLast

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width