LVectorFile::StartFeedLoad
#include "ltwrappr.h"
virtual L_INT LVectorFile::StartFeedLoad(pLoadFileOption=NULL, pFileInfo=NULL)
pLOADFILEOPTION pLoadFileOption; |
/* pointer to a structure */ |
pFILEINFO pFileInfo; |
/* pointer to a structure */ |
Initializes a file-load process in which you control the input stream. You must call the LVectorFile::FeedLoad function to supply buffered data, and you must call LVectorFile::StopFeedLoad when the loading is complete.
Parameter |
Description |
pLoadFileOption |
Pointer to a structure that contains information that determines the behavior of LVectorFile::FeedLoad |
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
This file-load process is useful when receiving transmitted images, such as those on the Internet. It works the same way as the LVectorFile::LoadFile function, except that your code supplies the image data. The file-load process works as follows:
1. |
You call the LVectorFile::StartFeedLoad function to initialize the file-load process and identify the process with a handle (phLoad). |
2. |
You create a buffer, and each time you fill it with information, you call the LVectorFile::FeedLoad function, which sends the data to the file-load process just as if the data were being read from a file on disk. |
3. |
Whenever it has enough data to do so, the file-load process behaves the same as in the LVectorFile::LoadFile function. It allocates and begins loading the bitmap, according to the flags that you specify in the LVectorFile::StartFeedLoad function. |
|
The file-load process does not update information in the bitmap handle until it has received enough information to do so. (Usually, the information, such as the bitmap height and width, is in the file header.) The file-load process will make the first call to the callback function whenever this information is available. |
4. |
To end the file-load process, you call the LVectorFile::StopFeedLoad function, which cleans up the process. If you call this function before supplying the complete file, it will successfully clean up the process, but will return a file-read error. You should trap the error if the load is canceled purposely. |
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
#define MAX_SIZE 1024
L_VOID Example47(HWND hWnd)
{
HFILE hf;
L_INT nRead;
L_UCHAR cBuf[MAX_SIZE]; // Buffer for receiving data
LVectorBase Vector;
LVectorFile VectorFile(&Vector, TEXT("s:\\temp\\images\\dxf\\test.dxf"));
VectorFile.StartFeedLoad();
hf = (HFILE)_tfopen (TEXT("s:\\temp\\images\\dxf\\POL008.DXF"), OF_READ);
for (;;)
{
nRead = (L_INT) _lread (hf, cBuf, MAX_SIZE);
if (nRead==0)
break;
// Supply image data from cBuf to the file-load process
LBuffer ImageBuffer(cBuf,MAX_SIZE) ;
VectorFile.FeedLoad ( &ImageBuffer);
}
VectorFile.StopFeedLoad();
//Do something with the file
}