Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

CArchive::SetLoadParams

Call SetLoadParams when you are going to read a large number of CObject-derived objects from an archive.

void SetLoadParams(
   UINT nGrowBy = 1024 
);

Parameters

nGrowBy
The minimum number of element slots to allocate if a size increase is necessary.

Remarks

CArchive uses a load array to resolve references to objects stored in the archive. SetLoadParams allows you to set the size to which the load array grows.

You must not call SetLoadParams after any object is loaded, or after MapObject or ReadObject is called.

Example

class CMyLargeDocument : public CDocument { ... };
void CMyLargeDocument::Serialize(CArchive& ar)
{
   if (ar.IsStoring())
      ar.SetStoreParams();  // use large defaults
   else
      ar.SetLoadParams();

   if (ar.IsStoring())
   {
      // code for storing CMyLargeDocument
   }
   else
   {
      // code for loading CMyLargeDocument
   }
}

See Also

CArchive Overview | Class Members | Hierarchy Chart | CArchive::SetStoreParams

Show:
© 2014 Microsoft. All rights reserved.