Results 1 to 5 of 5

Thread: Window Min and Max

Hybrid View

  1. #1

    Thread Starter
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    what window
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  2. #2
    Guest
    Put the following in a Form with a Timer
    Code:
    Private Sub Form_Load()
        Timer1.Interval = 1
    End Sub
    
    Private Sub Timer1_Timer()
        If Me.WindowState = 2 Then 'It's Maximized
        If Me.WindowState = 1 Then 'It's Minimized
        If Me.WindowState = 0 Then 'It's Normal
    End Sub

  3. #3
    New Member
    Join Date
    Sep 2000
    Posts
    9

    Angry Wrong Idea

    That would work great if was in the same form or project. My program is changing the resolution of the monitor, then running an exe through shell. I need to keep track of the window the exe is running in so if the user minimize the exe window the resolution would change back to the orginal settings.

  4. #4
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298

    try this


  5. #5
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298

    try this code.........


    paste this code into a form named form1. It will tell u if the form is maximised or not. To find out if any other window is maximised or not, replace Form1.hwnd with the handle of that window.

    Hope this helps.

    Code:
    Const WS_MAXIMIZE = &H1000000
    Const GWL_STYLE = -16
    Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    
    Private Sub Command1_Click()
    Dim Retval As Long
    Dim res
        Retval = GetWindowLong(Form1.hwnd, GWL_STYLE)
        If (Retval And WS_MAXIMIZE) = WS_MAXIMIZE Then
            Debug.Print "Form1 is maximized."
        Else
            Debug.Print "Form1 is not maximized."
        End If
    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