Reputation: 135
My application saves files to a database field. It will take file types of .pdf, .doc, .xls, and .html (for example) save them to the table, so I can later extract the value and open it as a file.
Currently, I am saving a file (type pdf in this example) to a Varbinary field in a SQL table I created. I am then reading that file back into a memory stream using the following code:
TBlobField(FieldByName('FileData')).SaveToStream(FileData);
I can save this to desktop as a pdf just fine. However I would like to open it directly from the memory stream with the appropriate application (in this example adobe acrobat). I could write this to file first and then open it with shellexecute but i would rather open it directly. How would I go about accomplishing this? Any help would be greatly appreciated, I've looked all over and can only find examples using shellexecute to open Filepaths. ShellExecuteEx claims the lpFile can be set to an object but i haven't had any luck getting it to work.
Upvotes: 0
Views: 2115
Reputation: 612794
You cannot do that. Memory is private to a process. When the Acrobat process executes, it cannot read your memory. You will have to save to a file and ask Acrobat to open that, or host a PDF viewer component in your process.
Upvotes: 2