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.

Posted on 2009-05-01
Last Modified: 2013-12-25
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?
Question by:mmarin1m
    LVL 31

    Accepted 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:

    Author Closing Comment

    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

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Suggested Solutions

    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now