home *** CD-ROM | disk | FTP | other *** search
/ CD Shareware Magazine 1999 April / CD_Shareware_Magazine_31.iso / Free / Prg / MessageBoxDemo.exe / frmManipulateMsgBox.frm (.txt) next >
Encoding:
Visual Basic Form  |  1998-10-23  |  2.5 KB  |  62 lines

  1. VERSION 5.00
  2. Begin VB.Form frmManipulateMsgBox 
  3.    AutoRedraw      =   -1  'True
  4.    Caption         =   "Manipulating The MessageBox"
  5.    ClientHeight    =   2940
  6.    ClientLeft      =   3150
  7.    ClientTop       =   3630
  8.    ClientWidth     =   4965
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   196
  11.    ScaleMode       =   3  'Pixel
  12.    ScaleWidth      =   331
  13.    Begin VB.CommandButton Command2 
  14.       Caption         =   "Position Message Box"
  15.       Height          =   375
  16.       Left            =   1350
  17.       TabIndex        =   1
  18.       Top             =   1530
  19.       Width           =   2250
  20.    End
  21.    Begin VB.CommandButton Command1 
  22.       Caption         =   "Self Closing Message Box"
  23.       Height          =   375
  24.       Left            =   1350
  25.       TabIndex        =   0
  26.       Top             =   960
  27.       Width           =   2250
  28.    End
  29. Attribute VB_Name = "frmManipulateMsgBox"
  30. Attribute VB_GlobalNameSpace = False
  31. Attribute VB_Creatable = False
  32. Attribute VB_PredeclaredId = True
  33. Attribute VB_Exposed = False
  34.   Option Explicit
  35.   ' demo project showing how to use the API to manipulate a messagebox
  36.   ' by Bryan Stafford of New Vision Software
  37.  - newvision@imt.net
  38.   ' this demo is released into the public domain "as is" without
  39.   ' warranty or guaranty of any kind.  In other words, use at
  40.   ' your own risk.
  41. Private Sub Command1_Click()
  42.   ' this shows a messagebox that will be dismissed after 4 seconds
  43.   ' set the callback timer and pass our application defined ID (NV_CLOSEMSGBOX)
  44.   ' set the time for 4 seconds (4000& microseconds)
  45.   SetTimer hWnd, NV_CLOSEMSGBOX, 4000&, AddressOf TimerProc
  46.   ' call the messagebox API function
  47.   Call MessageBox(hWnd, "Watch this message box close itself after four seconds", _
  48.       "Self Closing Message Box", MB_ICONQUESTION Or MB_TASKMODAL)
  49. End Sub
  50. Private Sub Command2_Click()
  51.   ' this positions the messagebox in the desired location on the screen.
  52.   ' the location is defined in the callback timer function
  53.   ' lock the desktop so that the initial position is not shown
  54.   Call LockWindowUpdate(GetDesktopWindow())
  55.   ' set the callback timer with our application defined ID (NV_MOVEMSGBOX)
  56.   ' set the time for 10 microseconds to allow the messagebox time to become active
  57.   SetTimer hWnd, NV_MOVEMSGBOX, 10&, AddressOf TimerProc
  58.   ' call the messagebox API function
  59.   Call MessageBox(hWnd, "Have you ever seen a message box that wasn't in the middle of the screen?", _
  60.       "Position A Message Box", MB_ICONQUESTION Or MB_TASKMODAL)
  61. End Sub
  62.