Chapter Three. The Secret Life of GetWindowText

THE GETWINDOWTEXT function is more complicated than you think. The documentation tries to explain its complexity with small words, which is great if you don’t understand long words, but it also means that the full story becomes obscured.

Here’s an attempt to give the full story.

How windows manage their text

THERE ARE TWO ways window classes can manage their text. They can do it manually or they can let the system do it. The default is to let the system do it.

If a window class lets the system manage its text, the system will do the following:

• Default handling of the WM_NCCREATE message takes the lpWindowName parameter passed to CreateWindow/Ex and saves the string in a “special place.”

• Default ...

Get The Old New Thing: Practical Development Throughout the Evolution of Windows now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.