Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 14th, 2003, 06:32 AM
Registered User
 
Join Date: Aug 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Determing which application has current focus

Hi Guys

Does anyone know how to use the windows API do detemine which application running under windows has focus.

I have a vb application that sets focus to a particular field on a form, I only want this to happen if this application has focus in windows.

Thanks in advance

 
Old August 14th, 2003, 06:55 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Take a look at Microsoft Knowledge Base Article 186908 "HOWTO: Determine When Your Application Gains or Loses Focus". It doesn't answer your question of determining which app has focus, but it will enable you to keep track of whether your application has focus.

hth
Phil
 
Old August 14th, 2003, 04:55 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Private Declare Function GetForegroundWindow Lib "user32" () As Long





Similar Threads
Thread Thread Starter Forum Replies Last Post
Focus dhoward Javascript 3 September 19th, 2007 02:54 AM
Focus dhoward VB.NET 2002/2003 Basics 0 September 13th, 2007 02:23 PM
focus kvanchi General .NET 2 December 13th, 2004 09:16 PM
Focus jbenson001 ASP.NET 1.x and 2.0 Application Design 2 February 18th, 2004 02:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.