Locations of visitors to this page


Vista Task Dialog

Onteora Software

Ken Tucker's Blog

About the author

Author Name is someone.
E-mail me Send mail

Recent comments

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2009

Vista Task Dialog

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

Currently rated 4.5 by 2 people

  • Currently 4.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: Vista
Posted by Ken Tucker on Thursday, December 07, 2006 4:12 AM
Permalink | Comments (1) | Post RSSRSS comment feed

Related posts

Comments

Steve us

Wednesday, November 12, 2008 9:07 PM

Steve

Thanks, This helped use the Task Dialogue without a class library Laughing

I filled in some of the missing code while I was at it...

Cheers
Steven

Public Enum TaskDialogIcon
Information = UInt16.MaxValue - 2
Warning = UInt16.MaxValue
[Stop] = UInt16.MaxValue - 1
Question = UInt16.MaxValue - 3
SecurityWarning = UInt16.MaxValue - 5
SecurityError = UInt16.MaxValue - 6
SecuritySuccess = UInt16.MaxValue - 7
SecurityShield = UInt16.MaxValue - 3
SecurityShieldBlue = UInt16.MaxValue - 4
SecurityShieldGray = UInt16.MaxValue - 8
NoIcon = -0
End Enum

Public Enum TaskDialogResult
None
OK = 1
Cancel = 2
Yes = 6
No = 7
Retry = 4
Close = 8
End Enum

Comments are closed