Originally posted by SkiNLaB
oops one more thing...

'Create a buffer
MyStr = String(GetWindowTextLength(hwnd) + 1, Chr$(0))

whats this buffer stuff?
Creates a buffer of length returned by the GetWindowTextLength and fills it with Null. You will get your Window Caption in this buffer.