Ciao,
ho un file (es. prova.xls ) registrato in un campo blob.
per poterlo aprire con l'applicazione collegata di windows faccio cosi:
1) estraggo il file e lo copio su disco
2) eseguo lo shellexecute
codice:
var
FileStream: TFileStream;
blob: TStream;
begin
blob := dm.IBDataSetAllegati.CreateBlobStream(dm.IBDataSetAllegatiALLEGATI, bmRead);
try
blob.Seek(0, soFromBeginning);
with TFileStream.Create(FAttachPath+dm.IBDataSetAllegatiITEM.AsString, fmCreate) do
try
CopyFrom(blob, blob.Size)
finally
Free
end;
finally
blob.Free
end;
{
try
FileStream := TFileStream.Create(FAttachPath+dm.IBDataSetAllegatiITEM.AsString, fmOpenRead );
finally
FileStream.Free
end;
}
ShellExecute( Application.Handle , 'open', PChar(FAttachPath+dm.IBDataSetAllegatiITEM.AsString), nil, nil, SW_MAXIMIZE);
vorrei evitare di copiare il file su disco lavorando solo in memoria.
grazie