Hi folks,
As I was browsing aimlessly (not quite, but for the purpose of the story, it'll do :)) through windows/win.c, I run into this:
/******************************************************************* * GetWindowTextW (USER32.@) */ INT WINAPI GetWindowTextW( HWND hwnd, LPWSTR lpString, INT nMaxCount ) { if (WIN_IsCurrentProcess( hwnd )) return (INT)SendMessageW( hwnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString );
/* when window belongs to other process, don't send a message */ if (nMaxCount <= 0) return 0; get_server_window_text( hwnd, lpString, nMaxCount ); return strlenW(lpString); }
My question is: shouldn't we alwas call WM_GETTEXT here, and do the switch between current process/other process in the lower levels?
What if the application sends the WM_GETTEXT message, and bypasses the GetWindowTextW? Then it wouldn't work, right? Just curious how all these are gonna play out...
"Dimitrie O. Paun" dpaun@rogers.com writes:
My question is: shouldn't we alwas call WM_GETTEXT here, and do the switch between current process/other process in the lower levels?
That's the way GetWindowText is supposed to work according to MSDN.
What if the application sends the WM_GETTEXT message, and bypasses the GetWindowTextW? Then it wouldn't work, right? Just curious how all these are gonna play out...
Sure it will work just fine (even better actually since it will do the right thing for edit controls etc.)