Try this...
VB Code:
  1. Option Explicit
  2.  
  3. Private Declare Function AttachThreadInput Lib "user32" (ByVal idAttach As Long, _
  4.                                                          ByVal idAttachTo As Long, _
  5.                                                          ByVal fAttach As Long) _
  6.                                                          As Long
  7. Private Declare Function GetForegroundWindow Lib "user32" () As Long
  8. Private Declare Function GetFocus Lib "user32" () As Long
  9. Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, _
  10.                                                                 lpdwProcessId As Long) _
  11.                                                                 As Long
  12. Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
  13.  
  14.  
  15. Private Sub Timer1_Timer()
  16. Dim hFore As Long, hFocus As Long
  17.  
  18.     hFocus = GetFocus
  19.    
  20.     If hFocus = 0 Then
  21.         hFore = GetForegroundWindow()
  22.         Call AttachThreadInput(GetWindowThreadProcessId(hFore, 0&), GetCurrentThreadId, True)
  23.         hFocus = GetFocus
  24.         Call AttachThreadInput(GetWindowThreadProcessId(hFore, 0&), GetCurrentThreadId, False)
  25.     End If
  26.    
  27.     Me.Caption = hFocus
  28.    
  29. End Sub

I put it in a timer to make sure it actually worked. It seems to.