L_TwainQueryFileSystem

#include "lttwn.h"

L_LTTWN_API L_INT L_TwainQueryFileSystem(hSession, FileMsg, pTwFile)

HTWAINSESSION hSession;

/* handle to an existing TWAIN session */

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

hSession

Handle to an existing TWAIN session. This handle is obtained by calling the L_TwainInitSession function.

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.

! = SUCCESS

An error occurred. Refer to Return Codes.

Comments

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

This function must be called after calling the L_TwainStartCapsNeg function and before calling the L_TwainEndCapsNeg function.

If the FileMsg parameter contains one of the following flags:

FILESYSTEM_MSG_CHANGEDIRECTORY

FILESYSTEM_MSG_CREATEDIRECTORY

FILESYSTEM_MSG_DELETE

FILESYSTEM_MSG_FORMATMEDIA

FILESYSTEM_MSG_RENAME

FILESYSTEM_MSG_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:

FILESYSTEM_MSG_GETCLOSE

FILESYSTEM_MSG_GETFIRSTFILE

FILESYSTEM_MSG_GETINFO

FILESYSTEM_MSG_GETNEXTFILE

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

If the FileMsg parameter contains the following flag:

FILESYSTEM_MSG_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:

L_TwainInitSession, L_TwainEndSession, L_TwainStartCapsNeg, L_TwainEndCapsNeg

Topics:

Getting or Setting TWAIN File System Information

 

TWAIN Functionality: Twain File System Functions

Example

 L_INT TwainQueryFileSystemExample(HWND hWnd)
{
   HTWAINSESSION hSession;
   APPLICATIONDATA AppData;
   TW_FILESYSTEM twFileSys;

   AppData.hWnd = hWnd;
   lstrcpy (AppData.szManufacturerName, TEXT("LEAD Technologies, Inc."));
   lstrcpy (AppData.szAppProductFamily, TEXT("LEAD Sample"));
   lstrcpy (AppData.szVersionInfo, TEXT("Version 1.0"));
   lstrcpy (AppData.szAppName, TEXT("LEAD Sample"));
   AppData.uStructSize = sizeof(APPLICATIONDATA);

   L_INT nRet = L_TwainInitSession(&hSession, &AppData);
   if (nRet != TWAIN_SUCCESS)
   {
      MessageBox(hWnd, TEXT("Error occurred during L_TwainInitSession"), TEXT("Notice"), MB_OK);
      return nRet;
   }
 
   nRet = L_TwainStartCapsNeg(hSession);
   if(nRet != SUCCESS)
      return nRet;

   memset(&twFileSys, 0, sizeof(TW_FILESYSTEM));
   nRet = L_TwainQueryFileSystem(hSession, FILESYSTEMMSG_AUTOMATICCAPTUREDIRECTORY, &twFileSys);
   if (nRet != TWAIN_SUCCESS) 
   {
      MessageBox(hWnd, TEXT("Error occurred during L_TwainQueryFileSystem"), TEXT("Notice"), MB_OK);
      return nRet;
   }
   
   nRet = L_TwainEndCapsNeg(hSession);
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_TwainEndSession(&hSession);
   if(nRet != SUCCESS)
      return nRet;

   
   return SUCCESS;
}