LTwain::LockContainer

#include "ltwrappr.h"

virtual L_INT LTwain::LockContainer(pCapability, ppContainer)

TW_CAPABILITY * pCapability;

/* pointer to a structure */

void ** ppContainer;

/* pointer to a pointer to a structure */

Gets the container information for the specified capability.

Parameter

Description

pCapability

Pointer to a TW_CAPABILITY structure from which to get the container.

ppContainer

Pointer to be updated with a pointer to the container.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function is used to lock the container present in the TW_CAPABILITY structure.

Once the user has the pointer to the container, the container may be changed. When the user has finished changing the container he or she must call LTwain::UnlockContainer to unlock the container. Note that this can also be accomplished using the API GlobalLock and GlobalUnlock functions.

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::UnlockContainer.

Topics:

How to Work with the Containers

 

TWAIN Functionality: Container Functions.

Example

void MyTestFunction(LTwain *MyClass)
{
   TW_CAPABILITY twCap;
   TW_ONEVALUE * ptwOneVal = NULL; 
   L_INT nRet;
   twCap.Cap = ICAP_XFERMECH; 
   twCap.ConType = TWON_DONTCARE16; 

   nRet = MyClass->GetCapability(&twCap, LTWAIN_CAPABILITY_GETCURRENT); 
   if (nRet != SUCCESS) 
   {
      MessageBox (NULL, TEXT("Failed to get capability"), TEXT("ERROR"), MB_OK); 
      return; 
   }

   if (twCap.ConType == TWON_ONEVALUE)
   {
      MyClass->LockContainer(&twCap, (void **)&ptwOneVal); 
      if (ptwOneVal) 
      {
         // Do processing
         MyClass->UnlockContainer(&twCap); 
      }
   }
}