

If the window does not have a caption, the return value is a null string. If the target window is owned by another process and has a caption, GetWindowText retrieves the window caption text.

If the window belongs to a different process, GetWindowText does something else. GetWindowText only sends WM_GETTEXT if the window belongs to the current process. GetWindowText doesn't just send WM_GETTEXT. Some of you are no doubt wondering: hey, wait a minute-if that works, why doesn't GetWindowText work? After all, GetWindowText just sends WM_GETTEXT, right? Wrong. CWnd* pWnd = GetOtherAppWindow() TCHAR buf pWnd->SendMessage(WM_GETTEXT, sizeof(buf)/sizeof(TCHAR), (LPARAM)(void*)buf) If you're programming in C, you'd naturally use the HWND instead of CWnd. To get the text of a window in another process, all you have to do is send WM_GETTEXT directly. Oh, I love softball questions they make me look so smart.
