ID:183880
 
I can't seem to get VB to call the Form_LostFocus sub. I've set it up like this:
Private Sub Form_LostFocus()
MsgBox "The form has lost focus. It works."
End Sub
(Yes, I put it in the correct place, under the form's code)

The message box never pops up, not when I change focus to another form on the program nor when I set forcus on my desktop (Second one is more important). Anyone know how I can call the sub when the form looses focus?
I think instead of WM_KILLFOCUS you need to be catching WM_ACTIVATE here. That will tell you if the window is being activated or deactivated. I don't recall what the equivalent is in VB.

Lummox JR
In response to Lummox JR
Well as you can see, I'm using the Lostfocus sub instead of the Gotfocus sub.
In response to Atomixkid
Atomixkid wrote:
Well as you can see, I'm using the Lostfocus sub instead of the Gotfocus sub.

Which has what to do with what, exactly? I'm saying you need to look at window activation/deactivation, not control focus.

Lummox JR