LVectorMemoryFile::LoadMemory

#include "ltwrappr.h"

virtual L_INT LVectorMemoryFile::LoadMemory(LMemoryBuffer, pLoadFileOption=NULL, pFileInfo=NULL)

Loads any supported vector file from memory.

Parameters

LBuffer& LMemoryBuffer

A LEAD buffer into which the file in memory will be loaded.

pLOADFILEOPTION pLoadFileOption

Pointer to a LOADFILEOPTION structure that contains information about loading the file from memory.

pFILEINFO pFileInfo

Pointer to a FILEINFO structure. This structure may contain file information used in loading an image, or it may be updated with information about the file being loaded.

If nothing is known about the file, pass NULL for this parameter, or declare a variable of type FILEINFO and set the FILEINFO.Flags to 0, then pass the address of the FILEINFO structure in this parameter. In this case, if the address of a FILEINFO structure is passed, the FILEINFO structure will be updated with the results of LFile::GetInfo.

If only the file type is known, set pFileInfo.Format to the file type and set pFileInfo.Flags to FILEINFO_ONLYFORMATVALID. This can also be done if LFile::GetInfo has been called previously, but values that affect the size of the image loaded have been changed (for example, by calling LFileSettings::SetPCDResolution or  LFileSettings::SetWMFResolution). In this case the FILEINFO structure pointed to by pFileInfo will be updated with the results of LFile::GetInfo.

If LFile::GetInfo has been called prior to calling this function, and no changes have been made to the contents of the structure filled by LFile::GetInfo, then the address of the filled FILEINFO structure can be passed for this parameter. In this case, the FILEINFO.Flags member should be set to FILEINFO_INFOVALID. The LFile::GetInfo function will set the FILEINFO.Flags to FILEINFO_INFOVALID. In this case the load will be faster since this function does not have to query the file filters for the file type.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

Note: More options are available in the LOADFILEOPTION structure.

The LMemoryBuffer parameter is passed by reference, and is a required parameter.

This function cannot be used in combination with the Redirect input / output functions.

You should never pass an uninitialized FILEINFO structure to this function.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT LVectorMemoryFile__LoadMemoryExample(HWND hWnd) 
{ 
   L_INT    nRet; 
   LBuffer  Buffer; 
 
   LVectorBase Vector; 
 
   //Load an image 
   Vector.VectorFile()->SetFileName(MAKE_IMAGE_PATH(TEXT("random.dxf"))); 
 
   nRet = Vector.VectorFile()->LoadFile(); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   //Save to memory buffer 
   LVectorMemoryFile VectorMemoryFile(&Vector); 
 
   VectorMemoryFile.SaveMemory(&Buffer,FILE_DXF); 
 
   //Erase the original vector image 
   VECTORHANDLE emptyVector; 
 
   nRet = Vector.SetHandle(&emptyVector, TRUE); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   //Load image from a second memory object memory 
   LVectorMemoryFile VectorMemoryFile2(&Vector); 
 
   nRet = VectorMemoryFile2.LoadMemory(Buffer); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   //attach to window 
   nRet = Vector.AttachToWindow(hWnd); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 
Help Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Vector C++ Class Library Help