What API function can get topmost window name without active(編號:5014)

I have try to use GetWindowPos to check the status value but I found It can't be updated (the "Success" value) :
Private Sub Timer1_Timer()  ' interval is set to 1000
Static counting As Integer
Dim Success As Integer

Success = SetWindowPos(hforewnd, -1, 0, 0, 1, 1, &H1)
If Success = 0 Then
counting = counting + 1
End If

text1.text = counting
text1.refresh

end sub

Thank you very much for your help
Alex