GetCapabilityFromFile example for Delphi
procedure TForm1.btnGetCapabilityFromFileClick(Sender: TObject);
var
nRet: L_INT;
uIndex: L_UINT;
uCapCount: L_UINT;
ptwCapability: pTW_CAPABILITY;
hFile: HTWAINTEMPLATEFILE;
begin
hFile:= 0;
nRet:= LEADTwain1.OpenTemplateFile ( @hFile, 'c:\test.ltt', LTWAIN_TEMPLATE_OPEN_READ );
if ( nRet = SUCCESS ) then
begin
uCapCount:= 0;
ptwCapability:= Nil;
nRet:= LEADTwain1.GetNumOfCapsInFile ( hFile, @uCapCount );
if ( nRet = SUCCESS ) then
begin
for uIndex:= 0 to uCapCount -1 do
begin
nRet:= LEADTwain1.GetCapabilityFromFile ( hFile, @ptwCapability, uIndex );
if ( nRet = SUCCESS ) then
begin
LEADTwain1.SetCapability ( ptwCapability, LTWAIN_CAPABILITY_SET );
end;
if ( ptwCapability <> Nil ) then
begin
LEADTwain1.FreeContainer ( ptwCapability );
GlobalFreePtr ( ptwCapability );
end;
end;
end;
LEADTwain1.CloseTemplateFile ( hFile );
end;
end;