Solved

how to know when my VB app has the focus?

Posted on 2001-09-13
3
172 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 100 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

733 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