Getforegroundwindow api should tell you which window has focus, well you could find it in win32api.txt or using apiviewer (I don't have vb on this comp)