File is in use by other process

edited August 2020 in General
Hi!

I have several (different) clients with this problem ( file is in use by other process). Delphi Sydney, RB20.03:

date/time : 2020-08-14, 17:14:26, 126ms
computer name : REALPC-PRO
user name : Realpc
registered owner : Realpc
operating system : Windows 10 x64 build 19041
system language : Dutch
system up time : 1 day 8 hours
program up time : 58 seconds
processors : 6x Intel(R) Core(TM) i5-9400 CPU @ 2.90GHz
physical memory : 1088/3965 MB (free/total)
free disk space : (C:) 420,53 GB
display mode : 1680x1050, 32 bit
process id : $287c
allocated memory : 188,26 MB
largest free block : 766,26 MB
executable : PeriFactSA.exe
exec. date/time : 2020-07-27 21:52
version : 9.19.64.33
compiled with : Delphi 10.4 Sydney
madExcept version : 5.0.99
callstack crc : $8decbc0d, $657631f4, $657631f4
exception number : 1
exception class : EFOpenError
exception message : Cannot open file "C:\Users\Realpc\AppData\Local\Temp\rspCD4B.tmp". Het proces heeft geen toegang tot het bestand omdat het door een ander proces wordt gebruikt.

main thread ($2f84):
004fc54e +126 PeriFactSA.exe System.Classes TFileStream.Create
004fc404 +020 PeriFactSA.exe System.Classes TFileStream.Create
029011b4 +038 PeriFactSA.exe ppPageCacheFile TppPageCacheFile.CreateFileStream
029010e4 +02c PeriFactSA.exe ppPageCacheFile TppPageCacheFile.Open
029010a9 +009 PeriFactSA.exe ppPageCacheFile TppPageCacheFile.SetActive
02900a65 +041 PeriFactSA.exe ppPageCacheFile TppPageCacheFile.AddPage
02902063 +04f PeriFactSA.exe ppThreadedPageCache TppThreadedPageCache.ehPageRequestThread_ReceivePage
02902756 +012 PeriFactSA.exe ppThreadedPageCache TppPageRequestThread.ehSynchronizedPageReceive
0050c87a +172 PeriFactSA.exe System.Classes CheckSynchronize
0073aeb1 +76d PeriFactSA.exe Vcl.Forms TApplication.WndProc
00510728 +014 PeriFactSA.exe System.Classes StdWndProc
758227db +00b user32.dll DispatchMessageW
0073b797 +0f3 PeriFactSA.exe Vcl.Forms TApplication.ProcessMessage
0073b7da +00a PeriFactSA.exe Vcl.Forms TApplication.HandleMessage
00736bda +1aa PeriFactSA.exe Vcl.Forms TCustomForm.ShowModal
031987a9 +029 PeriFactSA.exe FMain 4596 +3 TfrmMain.btnLayoutSettingsClick
015d8ef2 +032 PeriFactSA.exe dxBar TdxBarItem.DoClick
015d8e8f +03b PeriFactSA.exe dxBar TdxBarItem.DirectClick
015e9143 +11f PeriFactSA.exe dxBar TdxBarItemControl.ControlUnclick
015ecfc7 +057 PeriFactSA.exe dxBar TdxBarButtonControl.ControlUnclick
015cb5f8 +0e4 PeriFactSA.exe dxBar TCustomdxBarControl.DoLButtonUp
015ef9a5 +0d1 PeriFactSA.exe dxBar TdxBarControl.DoLButtonUp
015c9e14 +028 PeriFactSA.exe dxBar TCustomdxBarControl.WMLButtonUp
015c92ad +02d PeriFactSA.exe dxBar TdxBarDockedControl.WMLButtonUp
00616f96 +2be PeriFactSA.exe Vcl.Controls TControl.WndProc
0061be7e +686 PeriFactSA.exe Vcl.Controls TWinControl.WndProc
015cab0f +1cf PeriFactSA.exe dxBar TCustomdxBarControl.WndProc
015f16a5 +14d PeriFactSA.exe dxBar TdxBarControl.WndProc
0061b400 +02c PeriFactSA.exe Vcl.Controls TWinControl.MainWndProc
00510728 +014 PeriFactSA.exe System.Classes StdWndProc
758227db +00b user32.dll DispatchMessageW
0073b797 +0f3 PeriFactSA.exe Vcl.Forms TApplication.ProcessMessage
0073b7da +00a PeriFactSA.exe Vcl.Forms TApplication.HandleMessage
0073bb0d +0c9 PeriFactSA.exe Vcl.Forms TApplication.Run
032912f9 +a41 PeriFactSA.exe PeriFactSA 379 +177 initialization
754df987 +017 KERNEL32.DLL BaseThreadInitThunk





I used the following code. By the way the call in my code GetTempFile calls the Windows API GetTempFileName.

rptReport.Reset;
rptReport.Template.FileName := fullfilename;
rptReport.Template.LoadFromFile;
rptReport.Language := lgDutch;
rptReport.LanguageID := 'Dutch (Netherlands)';
rptReport.DataPipeline := pipREPORTLINES;
rptReport.PDFSettings.EncryptSettings.Enabled := false; // Nieuw V9.10
rptReport.PDFSettings.OpenPDFFile := false; // Nieuw V9.10
rptReport.OutlineSettings.CreateNode := false; // Nieuw V9.10
rptReport.OutlineSettings.CreatePageNodes := false; // Nieuw V9.10
rptReport.OutlineSettings.Enabled := false; // Nieuw V9.10
rptReport.OutlineSettings.Visible := false; // Nieuw V9.10
rptReport.TextFileName := '($MyDocuments)\Report.pdf'; // Nieuw V9.10
rptReport.Template.DatabaseSettings.DataPipeline := pipREPORTLINES; // Nieuw V9.10
rptReport.SaveAsTemplate := false; // Nieuwe V9.10
rptReport.AllowPrintToFile := false; // Nieuwe V9.10
rptReport.AllowPrintToArchive := false; // Nieuwe V9.10
rptReport.ResetDevices;
rptReport.DeviceType := dtScreen; // Nieuw V9.10
rptReport.Device := dvScreen;
rptReport.PassSetting := psTwoPass;
rptReport.AutoStop := false;
rptReport.CacheManager.CachePath := dtmBoot.GetTempFile;
rptReport.ArchiveFileName := dtmBoot.GetTempFile;


Should I use some method for caching to memory instead of disk? Or else? By the way, I don't need caching. This property 'CachePages' is turned OFF in the component. PLEASE HELP!!

Regards,
Emile


Comments

  • Hi Emile,

    The most likely cause of the issue is the Windows machine has some virus software that is locking the files. The virus software needs to be configured to allow local app data files.

    You can set Report.PreviewFormSettings.SinglePageOnly True to use the old single page preview. The newer scrollable page preview generates the pages in a background thread which caches the pages to implement the scrollable page preview.






    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited August 2020
    Thanks for your reply!!! But is it possible to use the new scrollable engine in memory ( without temp files?)
Sign In or Register to comment.