LVectorMemoryFile::LoadMemory
#include "ltwrappr.h"
virtual L_INT LVectorMemoryFile::LoadMemory(LMemoryBuffer, pLoadFileOption=NULL, pFileInfo=NULL)
LBuffer & LMemoryBuffer; |
/* an LBuffer object */ |
pLOADFILEOPTION pLoadFileOption; |
/* pointer to a structure */ |
pFILEINFO pFileInfo; |
/* pointer to a structure */ |
Loads any supported vector file from memory.
Parameter |
Description |
LMemoryBuffer |
A LEAD buffer into which the file in memory will be loaded. |
pLoadFileOption |
Pointer to a LOADFILEOPTION structure that contains information about loading the file from memory. |
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
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.
Required DLLs and Libraries
LVKRN For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
See Also
Functions: |
|
Topics: |
|
|
Example
L_VOID Example48(HWND hWnd)
{
int nRet;
LBuffer Buffer;
LVectorBase Vector;
//Load an image
Vector.VectorFile()->SetFileName(TEXT("s:\\temp\\images\\dxf\\test.dxf"));
Vector.VectorFile()->LoadFile();
//Save to memory buffer
LVectorMemoryFile VectorMemoryFile(&Vector);
VectorMemoryFile.SaveMemory(&Buffer,FILE_DXF);
//Erase the original vector image
VECTORHANDLE emptyVector;
Vector.SetHandle(&emptyVector, TRUE);
//Load image from a second memory object memory
LVectorMemoryFile VectorMemoryFile2(&Vector);
VectorMemoryFile2.LoadMemory(Buffer);
//attach to window
nRet = Vector.AttachToWindow(hWnd);
}