home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmManipulateMsgBox
- AutoRedraw = -1 'True
- Caption = "Manipulating The MessageBox"
- ClientHeight = 2940
- ClientLeft = 3150
- ClientTop = 3630
- ClientWidth = 4965
- LinkTopic = "Form1"
- ScaleHeight = 196
- ScaleMode = 3 'Pixel
- ScaleWidth = 331
- Begin VB.CommandButton Command2
- Caption = "Position Message Box"
- Height = 375
- Left = 1350
- TabIndex = 1
- Top = 1530
- Width = 2250
- End
- Begin VB.CommandButton Command1
- Caption = "Self Closing Message Box"
- Height = 375
- Left = 1350
- TabIndex = 0
- Top = 960
- Width = 2250
- End
- Attribute VB_Name = "frmManipulateMsgBox"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- ' demo project showing how to use the API to manipulate a messagebox
- ' by Bryan Stafford of New Vision Software
- - newvision@imt.net
- ' this demo is released into the public domain "as is" without
- ' warranty or guaranty of any kind. In other words, use at
- ' your own risk.
- Private Sub Command1_Click()
- ' this shows a messagebox that will be dismissed after 4 seconds
- ' set the callback timer and pass our application defined ID (NV_CLOSEMSGBOX)
- ' set the time for 4 seconds (4000& microseconds)
- SetTimer hWnd, NV_CLOSEMSGBOX, 4000&, AddressOf TimerProc
- ' call the messagebox API function
- Call MessageBox(hWnd, "Watch this message box close itself after four seconds", _
- "Self Closing Message Box", MB_ICONQUESTION Or MB_TASKMODAL)
- End Sub
- Private Sub Command2_Click()
- ' this positions the messagebox in the desired location on the screen.
- ' the location is defined in the callback timer function
- ' lock the desktop so that the initial position is not shown
- Call LockWindowUpdate(GetDesktopWindow())
- ' set the callback timer with our application defined ID (NV_MOVEMSGBOX)
- ' set the time for 10 microseconds to allow the messagebox time to become active
- SetTimer hWnd, NV_MOVEMSGBOX, 10&, AddressOf TimerProc
- ' call the messagebox API function
- Call MessageBox(hWnd, "Have you ever seen a message box that wasn't in the middle of the screen?", _
- "Position A Message Box", MB_ICONQUESTION Or MB_TASKMODAL)
- End Sub
-