13.3.2 Modifying the Instance Initialization Code

When an instance of ClipText is started, it must allocate a global memory object and fill it with an initial client-area text string. To do this, add the following statements to the instance initialization code:

hText = GlobalAlloc(GMEM_MOVEABLE,
    (DWORD) sizeof(szInitialClientAreaText));

if (hText == NULL || (lpszText = GlobalLock(hText)) == NULL) {
    OutOfMemory();
    return FALSE;
}

lstrcpy(lpszText, szInitialClientAreaText);
GlobalUnlock(hText);