Results 1 to 5 of 5

Thread: Form to flash

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2002
    Location
    Nigeria
    Posts
    16

    Form to flash

    Hi Guys,

    Please does anyone know how I can make a small form flash on the screen? I need my program to pop up little announcements once in a while.

    Thanks

    Nanfa

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    VB Code:
    1. Const FLASHW_STOP = 0 'Stop flashing. The system restores the window to its original state.
    2. Const FLASHW_CAPTION = &H1 'Flash the window caption.
    3. Const FLASHW_TRAY = &H2 'Flash the taskbar button.
    4. Const FLASHW_ALL = (FLASHW_CAPTION Or FLASHW_TRAY) 'Flash both the window caption and taskbar button. This is equivalent to setting the FLASHW_CAPTION Or FLASHW_TRAY flags.
    5. Const FLASHW_TIMER = &H4 'Flash continuously, until the FLASHW_STOP flag is set.
    6. Const FLASHW_TIMERNOFG = &HC 'Flash continuously until the window comes to the foreground.
    7. Private Type FLASHWINFO
    8.     cbSize As Long
    9.     hwnd As Long
    10.     dwFlags As Long
    11.     uCount As Long
    12.     dwTimeout As Long
    13. End Type
    14. Private Declare Function FlashWindowEx Lib "user32" (pfwi As FLASHWINFO) As Boolean
    15. Private Sub Form_Load()
    16.     'KPD-Team 1999
    17.     'URL: [url]http://www.allapi.net/[/url]
    18.     'E-Mail: [email][email protected][/email]
    19.     Dim FlashInfo As FLASHWINFO
    20.     'Specifies the size of the structure.
    21.     FlashInfo.cbSize = Len(FlashInfo)
    22.     'Specifies the flash status
    23.     FlashInfo.dwFlags = FLASHW_ALL Or FLASHW_TIMER
    24.     'Specifies the rate, in milliseconds, at which the window will be flashed. If dwTimeout is zero, the function uses the default cursor blink rate.
    25.     FlashInfo.dwTimeout = 0
    26.     'Handle to the window to be flashed. The window can be either opened or minimized.
    27.     FlashInfo.hwnd = Me.hwnd
    28.     'Specifies the number of times to flash the window.
    29.     FlashInfo.uCount = 0
    30.     FlashWindowEx FlashInfo
    31. End Sub
    32. Private Sub Form_Paint()
    33.     Me.CurrentX = 0
    34.     Me.CurrentY = 0
    35.     Me.Print "Click me !"
    36. End Sub

  3. #3
    Software Eng. Megatron's Avatar
    Join Date
    Mar 1999
    Location
    Canada
    Posts
    11,286
    That makes the title bar flash, not the Form. To make the actual Form flash, use the following code (requires a timer)
    Code:
    Private Sub Timer1_Timer()
    
        Me.Visible = Not Me.Visible
        
    End Sub

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Originally posted by Megatron
    That makes the title bar flash, not the Form [my post]
    True, but if the whole form flashes would'nt it be hard to read what was on it?

    nanfa: Are you looking to flash the entire form or just its title bar?

  5. #5
    Software Eng. Megatron's Avatar
    Join Date
    Mar 1999
    Location
    Canada
    Posts
    11,286
    Well he has both solutions now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width