?
Solved

how to know when my VB app has the focus?

Posted on 2001-09-13
3
Medium Priority
?
174 Views
Last Modified: 2006-11-17
Hi,

I have a VB app that needs to know when the user goes to another app while still leaving mine running. Is there anyway to do this? I tried Get/Lost_Focus, and Activate and Deactivate events, but they only let me know when a user is switching between forms in the SAME app.

Thanks
0
Comment
Question by:jhamlett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Accepted Solution

by:
dhodge earned 400 total points
ID: 6480619
put a timer on your control, on the timer event get the activewindow if it doesn't match the handle to yuor app you have lost the focus.

Declare Function GetActiveWindow Lib "user32" () As Long
0
 
LVL 2

Expert Comment

by:JanusFury
ID: 6480673
when he says handle he means hWnd.
and if you have multiple forms in your app, you'll have to compare the value returned by GetActiveWindow with all the hWnd's in your app instead of just one.
0
 

Author Comment

by:jhamlett
ID: 6480748
cool, thanks-)
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

764 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