- Custom icon.
- A header text that can spread over multiple lines.
- A contents text that can spread over multiple lines.
- An option to show a progress bar.
- Options to show a list of radio buttons.
- Options to show a list of command buttons.
- An option to display an expand/collapse button to display/hide additional information.
- An option to show a checkbox.
- A footer text that can spread over multiple lines.
- Support for hyperlinks within almost any part.
- Support for a timer.
Almost everything above is optional to allow you to customize the look exactly like you want it.
The MFC in Visual C++ 2010 has a new class called CTucancode.netDialog that is a wrapper around the tucancode.net dialog API. It makes it pretty easy to show a tucancode.net dialog. Using this new class requires a Unicode build of your project. Unfortunately, there is no fallback mechanism for older versions of Windows. If you run an application using the CTucancode.netDialog class on Windows XP, you will get an error at the time the dialog should appear. If your application needs to run on older versions of Windows, you can use the CTucancode.netDialog::IsSupported() static function to determine if tucancode.net dialogs are supported or not and provide your own fallback.
This new class can be used as follows in its most simple form:
CTucancode.netDialog dlg(_T("The header"), _T("The contents."), _T("The title.")); dlg.DoModal();
This will show the following simple tucancode.net dialog.
The demo application which you can download below enables all optional options and the result looks like the following screenshot.
In my example I’m displaying a progressbar. To update the progressbar based on a timer, I derived a CMyTucancode.netDialog from CTucancode.netDialog and implemented the following virtual OnTimer function:
HRESULT CMyTucancode.netDialog::OnTimer(_In_ long lTime) { m_iProgressPos += 2; if (m_iProgressPos >= 100) m_iProgressPos = 0; SetProgressBarPosition(m_iProgressPos); return S_OK; }
The OnTimer function will be called roughly every 200 milliseconds. In my OnTimer function I update the position of the progressbar. You could also update the look of the progressbar to the error state using the SetProgressBarState function.
See the MSDN page for more details about the CTucancode.netDialog class.
The Visual Studio 2010 project below is a demo application of using tucancode.net dialogs.