[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 262
  • Last Modified:

Is there an equivalent of ShellExecute or ShellExecuteEx that will take an array of bite as input argument? Windows API or .Net function will do.

I'm actually writing the array of bite to a temp folder and using ShellExecute to display the file. It works fine but it creates a security breach as the user can close the application before he or she closes the opened file in which case it stays written to the temp file. I have a few solutions in mind to do the cleanup but the best solution would be to have the equivalent of ShellExecute or ShelIExecuteEx that will take an array of bites as an input argument. It could be a Windows API or a .Net function. Any idea?
1 Solution
If you are worried about your file being left behind, simply specify the DeleteOnClose operand in the FileOptions property when you create your filestream. Then the operating system should delete the file once everyone closes it, and you shouldn't have to worry about the file being left behind.

There's an example here, albeit a little convoluted since it's got a lot of overloaded functions:

mmarin1mAuthor Commented:
We decided to log the open files and delete the files at application shutdown and startup since the DeleteOnClose was not 100% secure especially during system crash.

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Tackle projects and never again get stuck behind a technical roadblock.
Join Now