On the run saves into companion file possible?

I would like to know if it is possible to save any Documents (i.e. PDF Payslips) to the “Companion Files” (Folder) in my program while I am running the .exe? (Not while compiling!)

If this is possible, is it advisable?

Thanks

It’s not advisable and indeed not possible to save any documents to the “Companion Files” of your EXE file while running the .exe file.

The reason for this is that companion files are essentially part of your compiled executable: they are packed during the compilation process and their content is loaded into the application at runtime. Any changes made to these files while the application is running would not be reflected in the current session.

Another important factor to consider is security. Modifying the contents of an executable file (or its associated files) while it’s running can be seen as suspicious behavior by anti-virus software. This can lead to false-positive detections, potentially causing your application to be blocked or quarantined.

Instead of trying to modify the companion files, a better approach would be to handle file saving and loading within your application logic itself. For instance, your application could save PDF Payslips to a user-specified directory or a standard location like the end user’s Documents folder.

Thank you for the reply. I actually thought that it would maybe not be possible or at least, definitely not advisable.

Thank you once again.

Further to the above thread, when users install my Payroll Program for the first time, a Payslip Folder is automatically created inside the .exe folder in My Documents Directory. All Payslips generated are programatically converted to PDF and automatically stored inside the Payslip Folder. This is done (and Payslips opened) through Microsoft’s built-in PDF Reader.

My problem is that the folder and payslips are accessible to- and can be opened by some unauthorized person who knows his way around Directories on a computer. The Payslip Folder and/or payslips can however be either Zipped or Password protected…,but not without “third party” software!
I don’t want to (or rather cannot) include “third party” software in my compiled program and I do not want to instruct users of my program to first download “third party” software before it can be safely used. I would like them to install and use the program as is!

Any ideas from GDG (or any-one else) on how to handle this (security) problem?