Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module TaskDialog
- 'This code was made by DeStilleGast
- 'If you wish to use this code leave those line in it
- 'How to use it:
- 'TaskDialog.show(Mainform <like the owner from the dialog>
- 'Title <the title from the messagebox>
- 'Headtext <the blue text>
- 'Context <the black text>
- 'buttons <wana use more buttons use Or and not And>
- 'Icon <messagebox style>)
- 'To get a result back use this:
- 'Dim result as TaskDialog.TaskDialogResult
- 'result = TaskDialog.show(me, "Title", "Headtext", "Context", TaskDialogButtons.OK Or TaskDialogButtons.Close, TaskDialogIcon.Stop)
- '
- 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
- 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 = 0
- OK = 1
- Cancel = 2
- Yes = 6
- No = 7
- Retry = 4
- Close = 8
- End Enum
- Public Function show(ByVal _Frm As Form, ByVal _Title As String, ByVal _HeadText As String, ByVal _contents As String, _buttons As TaskDialogButtons, _icon As TaskDialogIcon) As TaskDialogResult
- Dim result As TaskDialogResult
- TaskDialog(_Frm.Handle, IntPtr.Zero, _Title, _HeadText, _contents, _buttons, _icon, result)
- Return result
- End Function
- End Module
Add Comment
Please, Sign In to add comment