With BMImport do //Composant BatchMove
begin
Source := Tableaimporter;
Destination := TableResult;
Mode := batCopy;
try
bdec := BDECallback.Create(nil,Tableaimporter.Handle,cbGENPROGRESS,@cbDataBuff, SizeOf(cbDataBuff),BatchProgressCallback,true) ;
try
Execute;
finally
FreeAndNil(bdec) ;
end;
except on E:Exception do
showmessage(E.Message) ;
end;
end;
function TForm1.BatchProgressCallback(CBInfo: Pointer): CBRType;
var
s : string;
begin
if pCBPROGRESSDesc(cbInfo).iPercentDone < 0 then
begin
//"Records appended: XYZ"
s := pCBPROGRESSDesc(cbInfo).szMsg;
Delete(s, 1, Pos(': ', s) + 1) ;
ProgressBar1.Position := Round((StrToInt(s) / Tableaimporter.RecordCount) * 100) ;
end
else
begin
ProgressBar1.Position := pCBPROGRESSDesc(cbInfo).iPercentDone;
end;
result := cbrCONTINUE;
end; //BatchProgressCallback
Partager