L_ILM_SAVEDATABASE

Send this message to have the ImageList Control save its contents as a multipage TIFF file (database).

Parameter

Description

wParam

Flag that indicates which items to save. Possible values are:

 

Value

Meaning

 

TRUE

Save only selected items.

 

FALSE

Save all items.

lParam

Pointer to the filename in which the database will be saved.

Returns

SUCCESS

Function was successful.

< 0

An error occurred. Refer to Return Codes.

Comments

The items will be saved as pages in a multipage TIFF file.

The format of the pages will be as follows:

BitsPerPixel

Format

1

FILE_CCITT_GROUP4

8

FILE_TIF_PACKBITS

24

FILE_TIF_JPEG

other

FILE_TIF

The pText for each item will be saved in the CMNT_SZNAMEOFPAGE comment.

The pTextExt for each item will be saved in the CMNT_SZNAMEOFDOC comment.

The associated macro is:

L_ImgListSaveDatabase(hWnd, bSelected, pszFilename)

For a complete list of available macros, refer to the Ltlst.h file.

See Also

Elements:

L_ReadFileComment, L_SetComment, L_WriteFileComment, L_ILM_LOADDATABASE, L_ILM_INSERT, L_ReadFileComments

Topics:

Using the ImageList Control
Image List Control Messages

Example

 L_INT ILM_SAVEDATABASEExample(HWND hCtrl, HWND hWndFrame)
{
   if(IsWindow(hCtrl) && IsWindow(hWndFrame))
   {
      L_INT nRet = SUCCESS;
      OPENFILENAME OFN;
      L_TCHAR szFilter[] = {TEXT("TIFF\0") TEXT("*.tif\0\0")};
      L_TCHAR szFile[L_MAXPATH] = TEXT("\0");

      ZeroMemory(&OFN, sizeof(OFN));

      OFN.lStructSize       = sizeof(OPENFILENAME);
      OFN.hwndOwner         = hWndFrame;
      OFN.lpstrFilter       = szFilter;
      OFN.lpstrCustomFilter = NULL;
      OFN.lpstrFile         = szFile;
      OFN.nMaxFile          = sizeof(szFile);
      OFN.lpstrFileTitle    = NULL;
      OFN.lpstrTitle        = TEXT("Save Database");
      OFN.lpstrDefExt       = NULL;
      OFN.lpfnHook          = NULL;

      if(GetSaveFileName(&OFN))
      {
         nRet = (L_INT)SendMessage(hCtrl, L_ILM_SAVEDATABASE, (WPARAM)FALSE, (LPARAM)szFile);
         if(nRet != SUCCESS)
            MessageBox(hWndFrame, TEXT("Error saving file!"), TEXT("Error"), MB_OK);
      }
      return nRet;
   }
   else
      return ERROR_INVALID_PARAMETER;
}