Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scroll through open windows

Status
Not open for further replies.
Aug 2, 2002
28
GB
Does anyone know of any easy way of periodically scrolling through open windows?

A call centre would like to periodically change the desktop window so that staff can see certain information, i.e. calls waiting etc.

Thank you.
 
Unfortunately, no. Do you think it is possible to use the SendeKey command to alt+tab to the next window and use a timer to hold the current window?
 
I think, it is better to utilize APIs similar to those that at that link.
 
Thanks vladk,

Have looked into APIs and come up with the following code.

This works in a fashion in that you can see it selecting the application in the task bar but the window does not open.

Any suggestions?

----------------------------------------------------------

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long

-----------------------------------------------------------

Private Sub Command1_Click()

Dim hwnd1 As Long

hwnd1 = FindWindow(vbNullString, "test.txt - NotePad")
SetForegroundWindow (hwnd1)
 
PaulHolmes,

Try add this function:

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

and call it like that:

ShowWindow hwnd1, 3

BTW, NEVER call functions like that:
SetForegroundWindow (hwnd1)

You should do it like this:

Call SetForegroundWindow (hwnd1)

or like this:

SetForegroundWindow hwnd1


vladk

 
When Microsoft introduced Windows 2000 they deliberately made it difficult for programmers to force a window from another application to the top. Why? Well who knows all their reasons, but I like it because having some program steal focus from a window I'm working on and blatting itself on top of everything without my permission is really, REALLY irritating.
 
Thank you vladk, that worked well.

Call centre is now up and running and displaying alternate screens intermittently. Just what we wanted. Brilliant!

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top