Jump to content

CM ALLOCRECORD: Difference between revisions

From EDM2
Created page with "This message allocates memory for one or more RECORDCORE structures. '''Note:''' If the CCS_MINIRECORDCORE style bit is specified when a container is created, then MINIRECORDCORE should be used instead of RECORDCORE and PMINIRECORDCORE should be used instead of PRECORDCORE in all applicable data structures and messages. ==Syntax== <PRE> param1 ULONG cbRecordData; Bytes of additional memory.: param2 USHORT nRecords; Number of records.: </PRE>..."
 
 
Line 19: Line 19:


==Returns==
==Returns==
;pRecord ([[PRECORDCORE]]) - returns
;pRecord (P[[RECORDCORE]]) - returns
: Returns a pointer or an error.
: Returns a pointer or an error.
::NULL: Allocation failed. The [[WinGetLastError]] function may return the following errors:
::NULL: Allocation failed. The [[WinGetLastError]] function may return the following errors:

Latest revision as of 21:52, 20 April 2025

This message allocates memory for one or more RECORDCORE structures. Note: If the CCS_MINIRECORDCORE style bit is specified when a container is created, then MINIRECORDCORE should be used instead of RECORDCORE and PMINIRECORDCORE should be used instead of PRECORDCORE in all applicable data structures and messages.

Syntax

param1
ULONG cbRecordData;   /* Bytes of additional memory. */

param2
USHORT nRecords;      /* Number of records. */

Parameters

cbRecordData (ULONG) - Input
Bytes of additional memory.
The number of bytes of additional memory that you want to reserve for your application's private use. This parameter must have a value between 0 and 64,000. If the value is 0, no additional memory is allocated, but a RECORDCORE data structure is allocated.
nRecords (USHORT) - Input
Number of records.
The number of container records to be allocated. This parameter must have a value greater than 0.

Returns

pRecord (PRECORDCORE) - returns
Returns a pointer or an error.
NULL: Allocation failed. The WinGetLastError function may return the following errors:
PMERR_INSUFFICIENT_MEMORY
PMERR_INVALID_PARAMETERS
Other: If the nRecords parameter has a value of 1, a pointer to a RECORDCORE structure is returned.
If the nRecords parameter has a value greater than 1, a pointer to the first RECORDCORE structure in the linked list of records is returned. The pointer to the next container record is set in the preccNextRecord field in each RECORDCORE data structure. The last pointer is set to NULL.

Remarks

The container control requires that the application use the CM_ALLOCRECORD message to allocate memory for container records.

When a record is allocated, the cb field of the record will be initialized with the size of the record structure type currently in use, either RECORDCORE or MINIRECORDCORE. If the CCS_MINIRECORDCORE style bit is not specified, the record is allocated according to the size of the RECORDCORE data structure. However, if the CCS_MINIRECORDCORE style bit is specified, the record is allocated according to the size of the MINIRECORDCORE data structure. This size should not be modified by the application.

Default Processing

The default window procedure does not expect to receive this message and therefore takes no action on it other than to return NULL.