GetCapabilityFromFile example for C++ Builder
void __fastcall TForm1::btnGetCapabilityFromFileClick(TObject *Sender)
{
L_INT nRet;
L_UINT uIndex;
L_UINT uCapCount;
pTW_CAPABILITY ptwCapability;
HTWAINTEMPLATEFILE hFile;
hFile= 0;
nRet= LEADTwain1->OpenTemplateFile ( &hFile, "c:\\test.ltt", LTWAIN_TEMPLATE_OPEN_READ );
if ( nRet == SUCCESS )
{
uCapCount= 0;
ptwCapability= NULL;
nRet= LEADTwain1->GetNumOfCapsInFile ( hFile, &uCapCount );
if ( nRet == SUCCESS )
{
for ( uIndex= 0; uIndex < uCapCount; uIndex ++ )
{
nRet= LEADTwain1->GetCapabilityFromFile ( hFile, &ptwCapability, uIndex );
if ( nRet == SUCCESS )
{
LEADTwain1->SetCapability ( ptwCapability, LTWAIN_CAPABILITY_SET );
}
if ( ptwCapability != NULL )
{
LEADTwain1->FreeContainer ( ptwCapability );
GlobalFreePtr ( ptwCapability );
}
}
}
LEADTwain1->CloseTemplateFile ( hFile );
}
}