• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 266
  • 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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

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