Results 1 to 5 of 5

Thread: Getting the windowstate

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Hooglede (belgium)
    Posts
    63

    Smile

    Is there API call for retrieving the state of a window(maximized,minimized) and how can I restore it to his
    original size.

    THANKS

  2. #2
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    Forms have a WindowState Property, I don't think you'll need to use the API for this one, heres a bit of demo code:
    Code:
    Private Sub Form_Resize()
    If Form1.WindowState = vbMinimized Then
        MsgBox "Hello"
        Form1.WindowState = vbNormal
    End If
    End Sub
    [Edited by crispin on 11-21-2000 at 07:17 AM]
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Hooglede (belgium)
    Posts
    63

    Smile

    Thanks for the reply but I ask for this because I calling an activeX DLL that has a form within. I am calling this AXDLL troughout a shell I've build. Now, I want to be able to determin if the AXDLL I've called is minimized by the user or not.(this to maximize it if the user click's again on the button to call the AXDLL.

    Thanks.

  4. #4
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Ok, click on this link:
    http://www.incognitasoftware.com/vbcomp.htm
    and look at the NuAPIView 2.0 file. This is a custom api viewer that has updated dll links and is probably 10,000 times better than the MS one.

    Download this, and the help file and lookup the "windowplacement" type declaration APIcall in the help file

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  5. #5
    Guest
    Use the IsIconic and IsZoomed API functions.
    Code:
    Private Declare Function IsIconic Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function IsZoomed Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    
    Private Sub Command1_Click()
        Dim hApp As Long
        hApp = FindWindowEx(0, 0, "Notepad", vbNullString)
        
        If IsIconic(hApp) Then MsgBox "It's minimized"
        If IsZoomed(hApp) Then MsgBox "It's maximized"
    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