"The GetWindowText function copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another application."
This is what described about the GetWindowText API in MSDN Documentation. GetWindowText API can not retrieve the text of a control in some other application. But this restriction was introduced since the Windows 2k/XP. So in XP and 2K you can not retrieve the text of a password control from other application. So to overcome this restriction many applications like PasswordSpy uses dll injection technique on Xp and 2kp versions. Now I found another way that can be easy than dll injection to retrieve the text of window controls of some other application.
The CloseWindow function minimizes (but does not destroy) the specified window.
HWND hWnd // handle to window to minimize
CloseWindow function minimizes the windows whose handle is provided as argument. Even it can minimize the control window of some other application (process). Now flaw of windows mechanism is that whenever a window is minimized it shows its text as its minimized caption. So if you will minimize the password control of some other application by calling CloseWindow api you can see the password of the that particular window (control). So no more need of dll injection for spying the password.