Solved

Getting information about active/open windows.

Posted on 1998-07-18
6
157 Views
Last Modified: 2010-05-03
Hi.
Is there a way of getting information about active/open windows.  Say, I have five windows open.   From which 3 are maximized or original size and 2 are minimized.  Is there a way of getting info about the windows which are maximized/original size either when active or not?  If so how would I find out the info.  Please send me code.  Thanks.
What I want is to be able to shake those open/maximized windows.  So, say from those 5 windows, 3 are open and are shaking.  If I close/minimize one window, well..shouldn't shake and if I maximize or restore or open a new program, the window should start shaking.
Send the code please.
Thanks
0
Comment
Question by:kermit007
6 Comments
 
LVL 8

Expert Comment

by:MikeP090797
Comment Utility
What exactly do you mean by 'Shake'?
0
 
LVL 1

Author Comment

by:kermit007
Comment Utility
make them move around.  sort of like in a shaking pattern only random.
0
 

Expert Comment

by:dwagner
Comment Utility
Do you mean windows only in your VB application, or windows in all applications currently running?

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Author Comment

by:kermit007
Comment Utility
I mean all the application windows.  I know there is a way to do it.  I have seen it done, just don't know how to do it.
0
 
LVL 9

Accepted Solution

by:
Dalin earned 200 total points
Comment Utility
kermit007,
Try the follow function. Let me know if you have problems.
Regards.
Dalin


Declare Function GetActiveWindow Lib "user32" () As Long

Declare Function GetParent Lib "user32" (ByVal Hwnd As Long) As Long

Declare Function ShowWindow Lib "user32" (ByVal Hwnd As Long, ByVal
       nCmdShow As Long) As Long

Declare Function IsIconic Lib "user32" (ByVal Hwnd As Long) As Long

Declare Function IsZoomed Lib "user32" (ByVal Hwnd As Long) As Long

Declare Function MoveWindow Lib "user32" (ByVal Hwnd As Long, ByVal X As
       Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long,
       ByVal bRepaint As Long) As Long
       Public Const SW_MAXIMIZE = 3
       Public Const SW_SHOWNORMAL = 1
       Public Const SW_SHOWMINIMIZED = 2


Function AccessMaximize()
       AccessMaximize = ShowWindow(GetAccesshWnd(), SW_MAXIMIZE)
End Function


Function AccessMinimize()      
       AccessMinimize = ShowWindow(GetAccesshWnd(), SW_SHOWMINIMIZED)
End Function


Function AccessMoveSize(iX As Long, iY As Long, iWidth As Long, iHeight
       As Long)
       MoveWindow GetAccesshWnd(), iX, iY, iWidth, iHeight, True
End Function


Function AccessRestore()
       AccessRestore = ShowWindow(GetAccesshWnd(), SW_SHOWNORMAL)
End Function


Function GetAccesshWnd()
       
       Dim Hwnd As Long
       Dim hWndAccess As Long
       
       Hwnd = GetActiveWindow()' Get the handle to the currently active window.
       hWndAccess = Hwnd
       

              While Hwnd <> 0 ' Find the top window
                     without a parent window.
                     hWndAccess = Hwnd
                     Hwnd = GetParent(Hwnd)
              Wend

       
       GetAccesshWnd = hWndAccess
       
End Function


Function IsAccessMaximized()


              If IsZoomed(GetAccesshWnd()) = 0 Then
                     IsAccessMaximized = False
              Else
                     IsAccessMaximized = True
              End If

End Function


Function IsAccessMinimized()


              If IsIconic(GetAccesshWnd()) = 0 Then
                     IsAccessMinimized = False
              Else
                     IsAccessMinimized = True
              End If

End Function


Function IsAccessRestored()


              If IsAccessMaximized() = False And IsAccessMinimized() = False Then
                     IsAccessRestored = True
              Else
                     IsAccessRestored = False
              End If

End Function

0
 
LVL 1

Author Comment

by:kermit007
Comment Utility
Thanks Dalin. :)
If I have any problems, I'll come back.  Thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem to delete range 4 54
Use Multiple Forms 4 38
Problem to skip loop 6 48
VBA filters 2 37
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now