Equinox Online Help - Language Reference - A to Z

Home

ExportPicture

Applies to
SyntaxExportPicture PictureItem, FileExpression
ExportPicture PictureItem, "CLIPBOARD", [hClip]
ExportPicture PictureItem, "FILE", hFile
ExportPicture PictureItem, "MEMORY", hMem
Action[Statement] Exports a picture from a picture field.
ScopeUsable anywhere.
Notes

This statement Exports an image from a specified picture field. PictureItem is the name of the picture field in the current record. There are four forms of the ExportPicture statement, corresponding to the four destinations to which you can write an image:

  • To a file path
  • To the Windows clipboard
  • To an open file handle
  • To an open memory handle

If you export the image to a file path, FileExpression is a string and identifies the image file name. The file-type must match the type that was originally assigned to the picture field. If you do not specify a path for the file, Equinox writes it into whichever directory is current at the time.

In order to export the file to the server, prepend "SERVER:" (in any case) to the FileExpression. This prefix is ignored by the single user version.

If you export a "BMP" format image to a file path, a standard file header (referred to as a BITMAPFILEHEADER in the Windows SDK documentation) is added to the beginning of the extracted file. All other formats and destinations are extracted without the header.

If you export the image to the Windows clipboard, you can access the clipboard handle using hClip. Equinox creates an object of type CF_DIB, which can be pasted into other Windows applications. If the image being extracted is not already in "BMP" format, it is converted.

If you wish to export the image to an open file handle, you must supply the handle using hFile, having first obtained it using FileOpen in one of the binary (random) modes.

If you wish to export the image to an open memory handle, you must supply the handle using hMem, having first obtained it using GlobalAlloc. The memory handle is allocated by Equinox and freed by the developer.

CategoryPictures
See Also AssignPicture, ErasePicture, ExtractPicture, ImportPicture
Example

The following examples assume a picture field PicField, character workareas HandleType(3), MemType(3) and a numeric workarea MemHandle(8,0)

|* File Operations *|
ExportPicture PicField, "C:\EQUINOX\PICTURE\TEST.BMP"
if syserror then Alert "ExportPicture to file failed"

|* Clipboard operations *|
ExportPicture PicField, "CLIPBOARD"
if syserror then Alert "ExportPicture to clipboard failed"

|* File handle operations *|
Block
handle hnd

if IsPicture(PicField) then
HandleType = PictureType(PicField)
FileOpen "C:\EQUINOX\PICTURE\HANDLE." & HandleType, RandomCreate, hnd
ExportPicture PicField, "FILE", hnd

if syserror then
Alert "ExportPicture returned", syserror
else
StatusLine "Ok - " & HandleType
end if
FileCloseAll
else
StatusLine "No picture"
end if
end block

|* Memory operations *|
External "kernel" GlobalFree uint

if MemHandle then
GlobalFree MemHandle
MemHandle = 0
end if

MemType = PictureType(PicField)
ExportPicture PicField, "MEMORY", MemHandle

if syserror then
Alert "ExportPicture failed"
else
StatusLine "Ok - Handle = 0x" & HexStr(MemHandle,1)
end if