Search code examples
c#.netwindowsself-extracting

Creating self-opening documents


I'm working on a project that has a proprietary file format. The project has a large install-necessary program and a smaller viewer that requires no install. I would like to be able to export files from my main application that are 'self opening' .exe's - that is, you can double click the exe and the embedded file will show (this is to make passing around the viewer to people who have NOT installed the main application able to view it - they will only pass around the document).

I'm a little lost on how to do this. My two thoughts that I've been investigating have come to a dead end. They are:

1) Embed the file in the viewer. I can do this manually through Visual Studio, and I've got a working demo of that, but I can't figure out a way to do this on the fly.

2) Create a self-extracting archive that extracts the file and the exe to temp and runs the exe with the file's name on command line. This sounds easy and possible (albeit hacky), but I've run into the issue that archive or install programs don't seem to have the command line necessary to do all that.

Any ideas? I prefer the second because it's easy, but the first because it seems more bullet proof / less hacky.


Solution

  • While bundling the exe into the document to make it a self-opening document is a cool idea, I don't think it's the best solution to the problem. The problem is that the documents require a specific viewer that is not readily available. So make the viewer as easy to get as possible.

    And that's what Xint0 suggested in the comments. Find a way to make the viewer as readily available as possible. No need to worry about piracy as it's only a viewer for a proprietary format so the only people interested in it will be people who will already have a document they can't open. So post the viewer on your company website and encourage the companies using the full software to post links to the viewer on their websites so that their customers can easily find it.