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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making my Application window active 1

Status
Not open for further replies.

webpager

Programmer
Mar 27, 2001
166
GB
I need your help again chaps.
I am cycling through all the active windows to get their handles. Once completed, the last window to be viewed has the "focus". If I click my application`s window it gets the focus but how do I return the focus to my window from within the controlling program.

I hope that makes sense.
 
I believe you can just use

Code:
Control.SetFocus

Dave Dardinger

 
Issue the command
ACTIVATE WINDOW myWindow TOP
I am not sure if this is what you need... ramani :)
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Thanks for the response but I don`t think I explained the problem very well the first time so I`ll have another go.

I am cycling through all the active windows on the computer using the MGETWINTXT function, not just my VFP application. The active window is a minimised Winamp window so I would have thought a Windows function would be required ie. SetForegroundWindow or similar to get it back on track.
I don`t find the Microsoft (MSDN) documentation very helpful as they never seem to give examples, only the basic facts, which is OK for you experts but not for us API newbies.
I hope I have explained myself better this time.
 
Hi WP,

I've had problems re-establishing keyboard focus after launching external programs before myself:

COM Server prevents application window from coming to front!
thread184-35877

See the code samples from:
thread184-36129

If your application is minimized on the taskbar(use the IsIconic function to determine this), you'll need to use the ShowWindow function to restore/maximize the window. Then use SetForegroundWindow to bring the window to the top of the Z-order.

Other functions you could explore include SetActiveWindow, BringWindowToTop, & SetWindowPos. Jon Hawkins

The World Is Headed For Mutiny,
When All We Want Is Unity. - Creed
 
Thanks for the response.
I have just sorted the problem.
I had launched a version of Winamp from my prog and it was that window which had the focus.
Launching Winamp with ! /N7 (inactive) allowed me to set the focus back to my APP.
Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top