Hello guys,

I am developing a program in VB 6.0 that has one function that capture the name of the main window running.

Ex: User opens the my program and minimize it ...
Even minimized the program know the name of the window that the User is using: Firefox, Google Chrome, My Computer, etc. ..

Well, this is already done.

- http://img685.imageshack.us/img685/9783/ss1hv.jpg
- http://img695.imageshack.us/img695/9449/ss2kg.jpg

But I want know when the User change of window!
Ex: Get out Firefox and go to My Computer.

>> Look my module:
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function GetForegroundWindow Lib "user32" () As Long

Public TituloJanela As String 'Contem o titulo da janela

>> My code
Private Sub Timer2Ok_Timer()

If PegarTituloJanela Then
lblJanela.Caption = TituloJanela
End If

End Sub

-- Time2Ok Properties
Enabled: Ture
Interval: 2

Okay, there is the following ...
It will display the name of the main window in use.

But I want every time that user change the window...
Came a msgBox!

But I have no idea how to do this. : /

If anyone can help me I'll be very happy.


PS: Sorry my bad english. :X