Results 1 to 9 of 9

Thread: [twinBASIC/VB6/VBA7] TaskDialogIndirect: cTaskDialog universal implementation x86/x64

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    6,010

    [twinBASIC/VB6/VBA7] TaskDialogIndirect: cTaskDialog universal implementation x86/x64

    cTaskDialog64 v1.2.4


    Updated on 23 Nov 2022


    This is a version of my cTaskDialog 1.2R2 project that uses conditional compilation to support both VB6/VBA6 and twinBASIC/VBA7 in either x86 or x64. See that page for complete project description and numerous more pictures and examples.
    Notably, people have had difficulty calling this API in VBA7 64bit, because it expects a structure without packing that on 32bit, doesn't happen, but does on 64bit. In twinBASIC, there's the PackingAlignment attribute. For VBA7x64, this project implements a workaround that copies the packed structure (since the attribute is conditionally only applied in tB) into a structure consisting of just the 160 raw bytes the API expects. It does this by copying each individual member to the correct offset, which is done for the button arrays too with the pointer for those set to the workaround ones.

    Since people have asked about using this in VBA, it goes back to the earlier method of using a module to help with subclassing, as the self-subclass code in the last VB6 version only works in VB6, and while twinBASIC supports AddressOf on class members, VBA7 does not. Note that there's a bug in the self-sub version that changes the way multiple pages are handled, sending all events through the first page class. So if you use multiple paged Task Dialogs, you'll now need to relocate events for the other pages to their own event Subs (the Demo does this with it's multi-page Demos).

    LongPtr in VB6/VBA?
    You'll need to add LongPtr support to use this codebase in VB6/VBA6. This thread provides two methods: via a typelib with an alias, or via an enum. For simplicity this project currently uses the Enum method (defined in modHelper.bas).

    In the ZIP
    The zip contains the .twinproj for twinBASIC, and an export directory with the project sources. You don't need the images in other projects, but you might need the manifest. The images in the root folder are just for the demo too.

    IMPORTANT: For full compatibility with all platforms, the class relies on external module to help with subclassing, so you must additionally add mTDHelper.bas to any project you add cTaskDialog.cls to (you do not need mTDSample for other projects, it's just for the Demo app).

    For twinBASIC, this projects requires Beta 108 or newer, although the latest Beta 154 is recommended to avoid an issue with an erroneous error saying GetSystemImageList is ambiguous (if you do wish to use an earlier version, restarting the compiler will get rid of that).

    Note for users of the previous VB6 version
    For multi-page Task Dialogs, it was actually a bug that all pages had their events raised in the first page's class. This version doesn't have the bug, and events will fire in the actual class of each page. So if you use multi-page dialogs, keep that in mind when switching to this version.


    UPDATED: Version 1.2.4 fixes improper VarPtr calls in the VBA7x64 routines in ShowDialog and NavigatePage.

    Version 1.2.3 fixes a repositioning issue on system with certain visual effects disabled. When min/max animation was disabled, the main window was resized immediately, so when it checked for a difference from the old value, there was none.

    Version 1.2.2 fixes the font scaling issues on some systems, the logo position/transparency issue, an issue with the dialog resizing too small after unexpanding an expando, the Long instead of LongPtr in one unused Sub, and a bug with different behavior in a page of a multi-page task dialog if you navigate back to it after loading another. Also adds a default date/time (Now) for disabled check datetimes, and the twinBASIC Logo Demo shows querying the class for current DPI to load a larger image if needed.



    This project can be downloaded from it's repository on GitHub, if you want to use that to report bugs or make feature requests (you can still do it here too). I'm no longer maintaining two separate points of download, gotta be honest they'll just get out of sync.
    Last edited by fafalone; May 2nd, 2023 at 01:40 PM.

Tags for this Thread

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