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

x
  • 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?
0
mmarin1m
Asked:
mmarin1m
1 Solution
 
Frosty555Commented:
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:

http://dotnet.org.za/markn/archive/2006/04/15/51594.aspx
0
 
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.
0

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