Question

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.

Was it helpful?

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.

OTHER TIPS

Using your method (1):

If you are using .NET, you could make your viewer program be one assembly, and your document be another assembly, then use ILMerge or the like to combine them into one final executable.

ILMerge is a commandline program, so you should be able to automate that step.

That way it should be fairly easy to have your customized viewer essentially just "load the other assembly that's with me" and perhaps call a function on the other assembly to get the data.

The only other piece of the puzzle is how to generate the 'document' assembly. I'm not entirely sure of the steps, but it seems like it should be doable.

Perhaps use CMake or similar to generate a VStudio project, and then use MSBuild to build it into an assembly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top