in reply to
Switch between gVim and Bash on Windows via Ctrl-Z and fg
Use Winspector Spy (original home site was taken offline a long time ago, so it has no home page now on google), or MS's Spy++ to learn the window and widget titles you want to switch to.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633520%28v=vs.85%29.aspx says GetWindowText only works in intra-process widgets, not inter-process widgets. So your "bash" is probably another Win32 process or a terminal app process (mintty.exe on cygwin).