#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. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
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 C 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. |
Functions: |
|
Topics: |
|
|
L_INT LTwain__LockContainerExample(LTwain *MyClass)
{
L_INT nRet;
TW_CAPABILITY twCap;
TW_ONEVALUE * ptwOneVal = NULL;
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 nRet;
}
if (twCap.ConType == TWON_ONEVALUE)
{
nRet = MyClass->LockContainer(&twCap, (void **)&ptwOneVal);
if(nRet != SUCCESS)
return nRet;
if (ptwOneVal)
{
// Do processing
nRet = MyClass->UnlockContainer(&twCap);
if(nRet != SUCCESS)
return nRet;
}
}
return SUCCESS;
}