Microsoft KB Archive/66452

INF: EM_SETTABSTOPS Does Not Free All of Local Heap Memory

PSS ID Number: Q66452 Article last modified on 04-26-1993

3.00 WINDOWS

Summary: When an EM_SETTABSTOPS message is sent to an edit control, a 12-byte fixed object remains in the local heap. Even if the window is destroyed, the 12-byte fixed object is still left in the local heap. By setting the tab stops to 0 (zero) prior to the destroy, the 12-byte fixed object is released. Below is a sample of how to correct this problem. The first SendMessage call should be inserted in the WM_CREATE code section, and the second call to SendMessage and the DestroyWindow call should be in the WM_CLOSE section. // During WM_CREATE: // This creates a twelve-byte fixed object in the local heap that // is not freed! SendMessage( hWndChild, EM_SETTABSTOPS, 1, (LONG)(LPINT)&n ); // During WM_CLOSE: // This frees the twelve-byte fixed object that windows leaves // in the local heap. SendMessage( hWndChild, EM_SETTABSTOPS, 0, (LONG)NULL ); DestroyWindow(hWndChild);

Additional reference words: 3.00 KBCategory: KBSubcategory: UsrCtlEdit Copyright Microsoft Corporation 1993.