I posted sample code using this class for raising simple Task Dialogs several times over the years, but I never gave it a CodeBank thread of its own.
Task Dialogs
Now that Windows XP is dead we can start making more use of features like this to avoid that old Windows 3.1/95 look and feel. This class is a basic wrapper for the calls required to make use of the Task Dialog.
You can expand upon this with callbacks to make use of even more Task Dialog features, but here we have the core subset covered without extra modules to host those callbacks. The result is a simple alternative to the VB6 MsgBox.
Requirements
Window Vista or later.
An application manifest selecting the Common Controls 6 assembly.
Startup logic that loads shell32.dll and comctl32.dll before any Forms or other UI elements - and in the correct sequence.
Details
STDlg.cls is a VB_PredeclaredId = True class so you don't have to create additional instances. It wouldn't make sense to have more than one in a program anyway.
It has just one method: TaskDialog(), loosely patterned on MsgBox().
Caution
STDlg.cls is unlikely to work correctly within the IDE if you run VB6.exe with a Common Controls 6 manifest itself. Most people don't do this though.
Normally it checks the loaded comctl32 version to determine whether to try to use Task Dialog or just substitute a MsgBox call instead. You could add a "running in the IDE" test to the code though.
![Name: sshot.png
Views: 36
Size: 16.0 KB]()
Task Dialogs
Now that Windows XP is dead we can start making more use of features like this to avoid that old Windows 3.1/95 look and feel. This class is a basic wrapper for the calls required to make use of the Task Dialog.
You can expand upon this with callbacks to make use of even more Task Dialog features, but here we have the core subset covered without extra modules to host those callbacks. The result is a simple alternative to the VB6 MsgBox.
Requirements
Window Vista or later.
An application manifest selecting the Common Controls 6 assembly.
Startup logic that loads shell32.dll and comctl32.dll before any Forms or other UI elements - and in the correct sequence.
Details
STDlg.cls is a VB_PredeclaredId = True class so you don't have to create additional instances. It wouldn't make sense to have more than one in a program anyway.
It has just one method: TaskDialog(), loosely patterned on MsgBox().
Caution
STDlg.cls is unlikely to work correctly within the IDE if you run VB6.exe with a Common Controls 6 manifest itself. Most people don't do this though.
Normally it checks the loaded comctl32 version to determine whether to try to use Task Dialog or just substitute a MsgBox call instead. You could add a "running in the IDE" test to the code though.