This project shows you how to read an image stored in a Stream buffer, and display it Inside of a GDImage graphic control.
Here is the code to load a Stream from the application's "EXE\images" subfolder.
PROCEDURE GDImageGetStreamFromFile(LOCAL sFileStream is string)
IF (IsWindow(gP.hCtrl)) THEN
IF (fFileExist(sFileStream)) THEN
nBufferSize is unsigned int = fSize(sFileStream)
fHandle is int = fOpen(sFileStream, foRead)
IF (fHandle <> -1) THEN
buffer is array dynamic of nBufferSize 1-byte int
fRead(fHandle, nBufferSize, &buffer)
fClose(fHandle); fHandle = 0
IF (NOT ZI_LoadImageFromStream(gP.hCtrl, &buffer, nBufferSize)) THEN
Note: The software perform an automatic format detection, and in case of success, the image is shown directly inside of the GDImage graphic control.