GetCapability example for Delphi

procedure TForm1.btnGetCapabilityClick(Sender: TObject); 
var
 nRet: L_INT; 
   twCap: TW_CAPABILITY; 
begin
   // Fill the TW_CAPABILITY structure with values
   twCap.Cap:= ICAP_XFERMECH; 
   twCap.ConType:= TWON_DONTCARE16; 
   nRet:= LEADTwain1.GetCapability ( @twCap, LTWAIN_CAPABILITY_GETCURRENT ); 
   if ( nRet <> SUCCESS ) then
   begin
      MessageBox ( Handle, 'Failed to get capability', 'ERROR', MB_OK ); 
      Exit; 
   end; 
   LEADTwain1.FreeContainer ( @twCap ); 
end;