How VB knows the application is swapped? 
Author Message
 How VB knows the application is swapped?

Hi there,

Does anyone knows how to make VB knows that the user swap to another
application.  Form_Deactivate and Form_LostFocus fail to do so.

Thanks in advance

Louis Woo



Mon, 31 Aug 1998 03:00:00 GMT  
 How VB knows the application is swapped?

Quote:
>Does anyone knows how to make VB knows that the user swap to another
>application.  Form_Deactivate and Form_LostFocus fail to do so.

Workaround:

Place a timer on the form and set it to fire every x milliseconds. In the
_Timer event, get the active window's hWnd using the GetActiveWindow API.
Then compare it to the .hWnd of your apps currently loaded form. If they
don't match, you're no longer the active app.


--
Newbiehood is not a period of time, it's a way of life.

http://www.sn.no/~balchen/
ftp://ftp.sn.no/user/balchen/



Wed, 02 Sep 1998 03:00:00 GMT  
 How VB knows the application is swapped?
in the forms Declaration section
Declare Function GetActiveWindow Lib "User" () As Integer

in a timer event

Sub Timer1_Timer ()
active% = GetActiveWindow()
If active% <> Me.hWnd Then
you no longer got the focus do whatever
End If
End Sub

Curt

Quote:

>Hi there,

>Does anyone knows how to make VB knows that the user swap to another
>application.  Form_Deactivate and Form_LostFocus fail to do so.

>Thanks in advance

>Louis Woo



Tue, 08 Sep 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Swapping application focus

2. I am learning VB.NET and am wondering....

3. I am trying igain - somebody must know

4. I AM A BEGINNER AND NEED TO KNOW..........

5. Will somwbody reply who knows what i am on about (IPX/SPX)

6. How can I know I am connected?

7. How i know when I am connected

8. How to know the sub name I am into

9. Swap file/resource problem: VB, Win95

10. I am about to release an application.....

11. byte swapping in VB

12. Running a VB Application within another VB Application

 

 
Powered by phpBB® Forum Software