LTwain::QueryFileSystem

#include "ltwrappr.h"

L_INT LTwain::QueryFileSystem (FileMsg, pTwFile)

FILESYSTEMMSG FileMsg;

/* file system message */

pTW_FILESYSTEM pTwFile;

/* pointer to a structure */

Performs certain tasks, or retrieves certain information, depending on the value of the FileMsg parameter.

Parameter

Description

FileMsg

Files system messages that determine the behavior of the function. For possible values, refer to the FILESYSTEMMSG.

pTwFile

Pointer to a TW_FILESYSTEM structure. This structure will be updated with, or will contain information used to change, the current TWAIN file system settings. This structure must be allocated.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function is only valid for TWAIN file systems for digital cameras.

If the FileMsg parameter contains one of the following flags:

FILESYSTEMMSG_CHANGEDIRECTORY

FILESYSTEMMSG_CREATEDIRECTORY

FILESYSTEMMSG_DELETE

FILESYSTEMMSG_FORMATMEDIA

FILESYSTEMMSG_RENAME

FILESYSTEMMSG_COPY

the pTwFile parameter must contain the proper information before calling this function. This function will use the provided information to changes settings within the TWAIN files system.

If the FileMsg parameter contains one of the following flags:

FILESYSTEMMSG_GETCLOSE

FILESYSTEMMSG_GETFIRSTFILE

FILESYSTEMMSG_GETINFO

FILESYSTEMMSG_GETNEXTFILE

this function, will update the pTwFile parameter with the corresponding information.

If the FileMsg parameter contains the following flag:

FILESYSTEMMSG_AUTOMATICCAPTUREDIRECTORY

this function will use information stored within the pTwFile parameter and will update the pTwFile parameter with any appropriate information.

For more information on the TW_FILESYSTEM structure, please refer to the TWAIN 1.9 Specification, available at www.twain.org.

Required DLLs and Libraries

LTTWN

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:

LTwain::InitSession, LTwain::EndSession

Topics:

Getting or Setting TWAIN File System Information

 

TWAIN Functionality: Twain File System Functions

Example

L_INT LTwain__QueryFileSystemExample(HWND hWnd)
{
   L_INT             nRet;
   LTwain            TwainSession;
   APPLICATIONDATA   AppData;
   TW_FILESYSTEM     twFileSys;
   memset(&AppData, 0, sizeof(APPLICATIONDATA));
   AppData.hWnd = hWnd; 
   AppData.uStructSize = sizeof(AppData);
   lstrcpy (AppData.szManufacturerName, _T("LEAD Technologies, Inc.")); 
   lstrcpy (AppData.szAppProductFamily, _T("LEAD Test Applications"));
   lstrcpy (AppData.szVersionInfo, _T("Version 1.0"));
   lstrcpy (AppData.szAppName, _T("TWAIN Test Application"));
   nRet = TwainSession.InitSession(&AppData); 
   if (nRet != TWAIN_SUCCESS)
   {
      MessageBox(hWnd, TEXT("Error occurred during call InitSession"), TEXT("Notice"), MB_OK);
      return nRet;
   }
   memset(&twFileSys, 0, sizeof(TW_FILESYSTEM));
   nRet = TwainSession.QueryFileSystem(FILESYSTEMMSG_AUTOMATICCAPTUREDIRECTORY, &twFileSys);
   if (nRet != TWAIN_SUCCESS)
   {
      MessageBox(hWnd, TEXT("Error occurred during call QueryFileSystem"), TEXT("Notice"), MB_OK);
      return nRet;
   }
   nRet = TwainSession.EndSession();
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}