Results 1 to 7 of 7

Thread: How can you tell when form is minimized?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441
    I have a MDI form application. When the form is minimized, I would like to flash the caption in the Taskbar. How can this be performed?
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  2. #2
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    When a form is maximized, the windowstate property of the form is equal to vbMaximized.

    If frm.WindowState = vbMaximized Then

    '...... FlashWindow procedure ......

    End If

    [Edited by Shafee on 09-11-2000 at 02:06 PM]

  3. #3
    Lively Member
    Join Date
    Jul 2000
    Location
    Ca
    Posts
    106
    Code:
    Private Sub Form_Resize()
      If Me.WindowState = 1 Then
        MsgBox "current form if minimized"
      End If
    End Sub

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Talking Another question

    Thank you both.

    Ok I got it to flash when minimized...

    Now on Form1 load I call a function which properly centers form within the MDIform, but if Form1 hasn't loaded yet, and the MDIform is minimized, Form1 is not centered when it is loaded. Where must I put the code on FORM1 to recenter once MDIform in maximized?
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    In the Resize event for your MDIForm, centre the other form there.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441
    Thank you all...
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  7. #7
    Guest
    Here is how to flash the window.

    Code:
    Declare Function FlashWindow& Lib "user32" (ByVal hwnd As Long, _
    ByVal bInvert As Long)
    Declare Function FindWindow& Lib "user32" Alias "FindWindowA" _
    (ByVal lpClassName As String, ByVal lpWindowName As String)
    Private Declare Sub Sleep Lib "kernel32" _
    (ByVal dwMilliseconds As Long)
    
    Dim h As Integer
    
    Private Sub Form_Load()
    h = FindWindow(vbNullString, "MyForm's Caption")
    Timer1.Interval = 100
    End Sub
    
    Private Sub Form_Resize()
    If Me.WindowState = 1 Then
    Timer1.Enabled = True
    Else
    Timer1.Enabled = False
    End If
    End Sub
    
    Private Sub Timer1_Timer()
    Do Until Me.WindowState <> 1
    hFlash = FlashWindow(h, 1)
    DoEvents
    Sleep (300)
    Loop
    Timer1.Enabled = False
    End Sub

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