|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
Windows Vista COMCTL32.dll v6
IntroductionAfter wasting innumerable hours hunting around the internet like a rabid squirrel for a way of using the Vista TaskDialog on pre-Vista versions of Windows, I decided to write one myself. "Necessity is the mother of invention." As I frequent The Code Project's website whenever I need help, I figured it was about time that I gave something back to the community. Hence, this article. BackgroundBasically, I wanted a class that would wrap the
This project takes Kevin's work a step further, in that the Using the CodeThe namespace for this project is static public DialogResult ShowTaskDialogBox(string Title,
string MainInstruction,
string Content,
string ExpandedInfo,
string Footer,
string VerificationText,
string RadioButtons,
string CommandButtons,
eTaskDialogButtons Buttons,
eSysIcons MainIcon,
eSysIcons FooterIcon)
Example 1: Using the Full ShowTaskDialogBox MethodDialogResult res =
PSTaskDialog.cTaskDialog.ShowTaskDialogBox("The main instruction text for
the TaskDialog goes here.",
"The content text for the task
dialog is shown here and the
text will automatically wrap as
needed.",
"Any expanded content text for
the task dialog is shown here
and the text will automatically
wrap as needed.",
"Optional footer text with an
icon can be included",
"Don't show me this message
again",
"Radio Option 1|Radio Option 2|
Radio Option 3",
"Command Button 1|
Command Button 2\nLine 2\
nLine 3|Command Button 3",
PSTaskDialog.eTaskDialogButtons.
OKCancel,
PSTaskDialog.eSysIcons.
Information,
PSTaskDialog.eSysIcons.Warning);
Here's a screenshot of the above (this is on Vista running in Emulation mode).
A few things to note:
Example 2: Showing a MessageBoxPSTaskDialog.cTaskDialog.MessageBox("MessageBox Title",
"The main instruction text for the
message box is shown here.",
"The content text for the message box
is shown here and the text will
automatically wrap as needed.",
"Any expanded content text for the
message box is shown here and the text
will automatically wrap as needed.",
"Optional footer text with an icon can be
included",
PSTaskDialog.eTaskDialogButtons.YesNo,
PSTaskDialog.eSysIcons.Information,
PSTaskDialog.eSysIcons.Error);
Shown below is a screenshot of the above on Windows XP. Please compare this image against the top two in this article. The code is exactly the same to produce any of these dialogs.
Example 3: Showing an Even More Simple MessageBoxPSTaskDialog.cTaskDialog.MessageBox("MessageBox Title",
"The main instruction text for the
message box is shown here.",
"The content text for the message box
is shown here and the text will
automatically wrap as needed.",
PSTaskDialog.eTaskDialogButtons.OK,
PSTaskDialog.eSysIcons.Warning);
if (PSTaskDialog.cTaskDialog.VerificationChecked)
{
// persist the users choice here
// e.g. write a registry entry to remember not to show this next time
}
Example 4: Showing a Radio ListboxPSTaskDialog.cTaskDialog.ShowRadioBox("RadioBox Title",
"The main instruction text for the
radiobox is shown here.",
"The content text for the radiobox is
shown here and the text will
automatically wrap as needed.",
"Any expanded content text for the
radiobox is shown here and the text
will automatically wrap as needed.",
"Optional footer text with an icon
can be included",
"Don't show this message again",
"Radio Option 1|Radio Option 2|
Radio Option 3|Radio Option 4|
Radio Option 5",
PSTaskDialog.eSysIcons.Information,
PSTaskDialog.eSysIcons.Warning);
Example 5: Showing a Command ButtonPSTaskDialog.cTaskDialog.ShowCommandBox("CommandBox Title",
"The main instruction text for the
commandbox is shown here.",
"The content text for the commandbox
is shown here and the text will
automatically wrap as needed.",
"Any expanded content text for the
commandbox is shown here and the text
will automatically wrap as needed.",
"Optional footer text with an icon
can be included",
"Don't show this message again",
"Command Button 1|Command Button 2|
Command Button 3|Command Button 4",
true,
PSTaskDialog.eSysIcons.Information,
PSTaskDialog.eSysIcons.Warning);
Please take a look at the source code in Form1.cs in the TaskDialogTest folder to see exactly how Known Limitations
History
| |||||||||||||||||||||