Custom File format

philprice

Well-known member
Joined
Mar 21, 2003
Messages
116
Location
Hull, UK
Hi there, how do I go about making my own custom file format? Im working on a Visio-esq project and I want to be able to save "objects" into files (elements that can be rendered on the display context, i.e. Squares, arrows etc) Im looking to save some point data and various other bits and bobs into a file along with a jpeg (or bitmap) preview of that object.

The same goes for "scene" objects, I want to serialize the scene (not a problem) - but also have previews and other data in the file, what is the best method for doing this?
 
so you want something like PowerPoint (just an example) .. where you can see in the preview window what the ppt contains? ...

From what I would guess happens is that the preview window utilizes that program which is associated with the extension .. I mean you cant see a PowerPoint preview if you dont have PowerPoint installed.. can you?...

So you would have to read up on the preview API and how windows handles it, but im sure you wouldnt have to store a jpg in your data, the preview would have to access the data in a certain way then make a jpg (or whatever it uses) to display to the user.

Hope that helped..
 
Its fine to use the preview API, but im looking for persistant data, as I dont want to generate a load of thumbnails everytime i load the program, itll be a huge strain on CPU time thats not really needed (i want to display icons of object types), so thats why i want to put multiple data types in one file....
 
Just out of interest, we are talking about just previewing whats in the file before you open it... or have i got the wrong end of the stick??

I guess you could write a small preview into a file (lets face it, its possible, but I dont know how). Then treat it a little like a dataset file .. so you have your data (text) .. then you have a picture for that portion of text or for the whole file ..
 
Back
Top