home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / source / chap04 / 04vbu03 / flash.frm (.txt) next >
Encoding:
Visual Basic Form  |  1995-08-21  |  2.0 KB  |  68 lines

  1. VERSION 4.00
  2. Begin VB.Form wFlash 
  3.    Caption         =   "Flashing Window"
  4.    ClientHeight    =   930
  5.    ClientLeft      =   1905
  6.    ClientTop       =   1635
  7.    ClientWidth     =   4020
  8.    Height          =   1335
  9.    Left            =   1845
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   930
  12.    ScaleWidth      =   4020
  13.    Top             =   1290
  14.    Width           =   4140
  15.    Begin VB.CommandButton cbStop 
  16.       Caption         =   "&Stop"
  17.       Height          =   615
  18.       Left            =   2280
  19.       TabIndex        =   1
  20.       Top             =   135
  21.       Width           =   1215
  22.    End
  23.    Begin VB.CommandButton cbFlash 
  24.       Caption         =   "&Flash"
  25.       Height          =   615
  26.       Left            =   360
  27.       TabIndex        =   0
  28.       Top             =   135
  29.       Width           =   1215
  30.    End
  31.    Begin VB.Timer timerFlasher 
  32.       Enabled         =   0   'False
  33.       Left            =   1770
  34.       Top             =   195
  35.    End
  36. Attribute VB_Name = "wFlash"
  37. Attribute VB_Creatable = False
  38. Attribute VB_Exposed = False
  39. Option Explicit
  40.     ' declarations differ between Windows 3.1 and Win32.
  41. #If Win16 Then
  42.     Private Declare Function FlashWindow Lib "User" (ByVal hWnd As Integer, ByVal bInvert As Integer) As Integer
  43. #Else
  44.     Private Declare Function FlashWindow Lib "User32" (ByVal hWnd As Long, ByVal bInvert As Long) As Long
  45. #End If
  46. Private Sub cbFlash_Click()
  47.     timerFlasher.Interval = 500
  48.     timerFlasher.Enabled = True
  49. End Sub
  50. Private Sub cbStop_Click()
  51.     Dim iRet As Integer
  52.         ' stop the flashing
  53.     timerFlasher.Enabled = False
  54.         
  55.         ' Restore the window to its proper state
  56.     iRet = FlashWindow(Me.hWnd, False)
  57. End Sub
  58. Private Sub Form_Load()
  59.         ' make sure the timer isn
  60. t running when the program loads.
  61.     timerFlasher.Enabled = False
  62. End Sub
  63. Private Sub timerFlasher_Timer()
  64.     Dim iRet As Integer
  65.         ' make the window flash
  66.     iRet = FlashWindow(Me.hWnd, True)
  67. End Sub
  68.