How do I convert this to KiX?

Code:
    Set objWinShell = CreateObject("Shell.Application")
Set objWindows = objWinShell.Windows
For varCount = 0 To objWindows.Count - 1
On Error Resume Next
If objWindows(varCount).Hwnd = varHwnd Then
Set objBrowserObject = objWindows(varCount)
If Err = 0 Then
Exit For
Else
Err = 0
End If
End If
Next