␡                        
                            
                    - How windows manage their text
 - Enter GetWindowText
 - What if I dont like these rules?
 - Can you give an example where this makes a difference?
 - Why are the rules for GetWindowText so weird?
 
                    This chapter is from the book 
                    
                    
                
            Can you give an example where this makes a difference?
CONSIDER THIS CONTROL:
SampleWndProc(...)
{
    case WM_GETTEXT:
        lstrcpyn((LPTSTR)lParam, TEXT("Booga!"), (int)wParam);
        return lstrlen((LPTSTR)lParam);
    case WM_GETTEXTLENGTH: return 7; // lstrlen("Booga!") + null
    ...
}
And application A, which does this:
hwnd = CreateWindow("Sample", "Frappy", ...);
Now consider process B, which gets the handle to the window created by application A (by whatever means):
TCHAR szBuf[80]; GetWindowText(hwnd, szBuf, 80);
This will return szBuf = "Frappy" because it is getting the window text from the special place. However
SendMessage(hwnd, WM_GETTEXT, 80, (LPARAM)szBuf);
will return szBuf = "Booga!"
