ShowTemplateDlg example for Delphi

Function TForm1.LEADTwain1SaveCapabilityEvent(
  pCapability: pTW_CAPABILITY): Integer; 
begin
   // Do pre operations on data to save

   Result:= SUCCESS; 
end; 

procedure TForm1.btnShowTemplateDlgClick(Sender: TObject); 
var
 nRet: L_INT; 
begin
 LEADTwain1.EnableSaveCapabilityEvent:= True; 
   nRet:= LEADTwain1.ShowTemplateDlg ( 'c:\Test.ltt' ); 
   if ( nRet <> SUCCESS ) then
   begin
      // Error check procedure
   end; 
end;