i have read 1 post on internet
There is two different ways a window can handle its text. Either let system handle it or handle it themself. If the system handles it it will store the text passed to CreateWindow/CreateWindowEx in a dedicated memory area. This is returned by GetWindowText or by sending WM_GETTEXT. However the window/control can handle it themselfs, which is pretty common for a control to do. In that case the control handles the WM_GETTEXT and WM_GETTEXTLENGTH messages and returns whatever text they want/use.
So when you send a WM_GETTEXT message, if the window/control doesn't handle that message itself, Windows will return the string stored in the dedicated memory area when the window was created, and it will replace it if a WM_SETTEXT message is sent. This is the default behaviour.
Now, if you use the GetWindowText function it will send a WM_GETTEXT message if the window you're requesting the text for have been created by the same process that calls GetWindowText. But if you use GetWindowText on a control in another process it will return the text stored in this special memory area and not send a WM_GETTEXT message. The reason for this is simply because if GetWindowText would send the message to a window that is hung it would never return, hence hanging the process that call the function. That would cause a huge problem for such things as the task switcher that would hang if one window is hung. A hung application/window shouldn't cause problems for other applications/windows.
This is also the reason you can get different values using GetWindowText and sending WM_GETTEXT to a control. The control was created with a call to CreateWindow or CreateWindowEx with one text (that will be returned by GetWindowText) and then handles the WM_GETTEXT message itself and returns something else. So if you want to be sure to get the correct text you should use WM_GETTEXT for other processes, however you should also be aware that if the window/control in question is hung SendMessage will never return. So the best approach is to use SendMessageTimeout instead of SendMessage.
why i hook
but dont catch event GetWindowText in current App ?