GetNumericContainerFRAMEValue example for Delphi

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

   nRet:= LEADTwain1.GetNumericContainerItemType ( @twCap, @nItemType ); 
   if ( nRet <> SUCCESS ) then
   begin
      MessageBox ( Handle, 'Failed to get capability item type', 'ERROR', MB_OK ); 
   end
   else
   begin
    if ( nItemType = TWTY_FRAME ) then
    begin
       nRet:= LEADTwain1.GetNumericContainerFRAMEValue ( @twCap, 0, @twFrame ); 
       if ( nRet <> SUCCESS ) then
          MessageBox ( Handle, 'Failed to get capability item value', 'ERROR', MB_OK ); 
    end; 
   end; 
end;