I have developed a C# WPF application that will display .pdf files to the user. The user can load the PDF directly
File --> Load --> (select PDF file) --> Open
after selecting the PDF, and pressing open, the PDF is displayed from inside the application.
Or they can open a ZIP folder that contains a single PDF file, and the PDF inside that ZIP will automatically be shown to the user from inside the application
File --> Load --> (select ZIP folder) --> Open
after selecting the ZIP, (it is known that the contents of the zip consists entirely of one single PDF), and pressing open, the PDF inside that ZIP is displayed from inside the application (in the same way as just opening a PDF directly).
I now want to modify my program so that it can open a 'folder' that has a custom extension- i.e. I want to create a folder, similar to a ZIP- containing a single PDF file, but the extension of that folder should be something I choose, rather than
.zip, for example, so that I could have a compressed folder called
folder.abc, containing a single PDF
I then want to associate the extension
.abc with my application, so that any time the user double clicks a
.abc file/ folder, it is automatically opened by my application.
What I don't know, is how I can create custom extension and use it? For example, how could I change
folder.abc, and have anything with a
.abc extension automatically assigned to be opened by my application when a user double clicks it?
Ok, so I can create custom files with my own extension by creating a .txt file, opening it, and then saving it again, setting its 'type' to
All Files, and giving it a name that ends in
customFile.abc, and I can associate my extension with my application by right clicking it, going to 'Open with', and selecting my own application.
I can also do this with a ZIP folder in the same way.
However, when I currently open any of the files/ folders that I have given my custom extension to, they just open my application with a blank window, i.e. the .pdf files that they contain are not displayed- I have to then use my application window to open them. I do this by selecting File --> Open and choosing the
.abc file that I have just double clicked on to open my application window, and it then displays the PDF that this
.abc file contains...
Why does it not automatically display the contained .pdf when I double click on it from within windows explorer?