Hi Team,
I am encountering an issue while attempting to delete a .pdf
file generated in a temporary folder on my machine. Below are the steps to replicate the problem:
- Copy the contents of the file into a blob variable.
- Create a
.pdf
file in the temporary folder (e.g.,C:/temp/
). - Create a window (
w_main
, type: main window) containing an OLE control namedMicrosoft Web Browser
to display the.pdf
file using the file path URL (e.g.,C:/temp/samplefile.pdf
). - Open the
w_main
window within the MDI application. - In the
Open
event of thew_main
window, write code to display the.pdf
file in the OLE control. - After the
w_main
window is open, click 2-3 times outside the PowerBuilder application on the desktop (e.g., right-click and refresh). - In the
Close
event of thew_main
window, attempt to delete the temporary.pdf
file using theFileDelete
function.
Here is a snippet of the code used in the Close
event:
Issue:
The FileDelete
function returns false
for the above code.
Observations:
- If a message box is added before the
FileDelete
call, the file is successfully deleted. - Clicking outside the PowerBuilder application and then closing the
w_main
window seems to lock the file, possibly due to Adobe Acrobat Reader. - I tried using
Yield()
andSleep()
functions beforeFileDelete
, but they didn’t resolve the issue. - I have check the permissions as well which is not the issue in this case.
- Filedelete returns false only when I click anywhere on machine outside the Powerbuilder Application.
- Issue is replicated on PB2019 R3, PB2022 R3
Could you please help us to identify the root cause of this issue and if possible please suggest a solution?
Best regards,
Ritesh Kumar