Vista Task Dialog
Windows Vista has some cool looking new Dialog's. This example will show how to use the TaskDialog an improved message box with Visual Studio 2005.
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim x As Integer
TaskDialogHelper.TaskDialog(Me.Handle, IntPtr.Zero, "Title", "Are you sure?", "This is a test", TaskDialogHelper.TaskDialogButtons.Ok, TaskDialogHelper.TaskDialogIcon.Question, x)
End Sub
End Class
Public Class TaskDialogHelper
Public Enum TaskDialogButtons
Ok = &H1
Cancel = &H8
Yes = &H2
No = &H4
Retry = &H10
Close = &H20
End Enum
Public Enum TaskDialogIcon
Information = UInt16.MaxValue - 2
Warning = UInt16.MaxValue
[Stop] = UInt16.MaxValue - 1
Question = 0
SecurityWarning = UInt16.MaxValue - 5
SecurityError = UInt16.MaxValue - 6
SecuritySuccess = UInt16.MaxValue - 7
SecurityShield = UInt16.MaxValue - 3
SecurityShieldBlue = UInt16.MaxValue - 4
SecurityShieldGray = UInt16.MaxValue - 8
End Enum
Public Enum TaskDialogResult
None
OK
Cancel
Yes = 6
No = 7
Retry = 4
Close = 8
End Enum
Public Declare Auto Function TaskDialog Lib "comctl32.dll" (ByVal hWnd As IntPtr, ByVal hInstance As IntPtr, _
ByVal WindowTitle As String, ByVal MainInstruction As String, ByVal Content As String, _
ByVal CommonButton As Integer, ByVal DialogIcon As Integer, ByRef PushedButton As Integer) As Integer
End Class