When an instance of ClipText is started, it must allocate a global memory object and fill it with an initial client-area text string. Add the following statements to the instance initialization code:
if (!(hText = GlobalAlloc(GMEM_MOVEABLE,
(DWORD)sizeof(szInitialClientAreaText)))) {
OutOfMemory();
return (FALSE);
}
if (!(lpszText = GlobalLock(hText))) {
OutOfMemory();
return (FALSE);
}
lstrcpy(lpszText, szInitialClientAreaText);
GlobalUnlock(hText);