Results 1 to 6 of 6

Thread: [2005] Creating Formats

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    [2005] Creating Formats

    Hello, is it possible for me to create my own type of file format which only my program can view or is compatible with?

    If yes then how would i make the file format and how would i make my program able to view it? Im guessing my program will have to be the one to create the file.

  2. #2
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2005] Creating Formats

    Just change the extension! It's as simple as that! Then, only your program will know what to do/how to open the file.
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  3. #3
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: [2005] Creating Formats

    Yes, obi1kenobi is right. If your program is saving the file, than just save it with a different extension.
    Be sure to open it using that same extension aswell obviously.

    However, windows will not automatically recognize that your file format belongs to your program (for example, if you rename something to ".txt", windows will usually open it with notepad. If you would rename a file to ".yourextension", this will probably not happen.

    I'm not sure how to make that happen, you probably have to do some registry editing.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    Re: [2005] Creating Formats

    Thankyou for your help that seems very simple.

  5. #5
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2005] Creating Formats

    No, actually I remember reading somewhere on this forum about a way to make Windows recognize your format as the native format of your application. I'll do a bit of searching and if I find the thread I'll post it.

    EDIT: Here it is, I've found it: http://www.vbforums.com/showthread.php?t=503333
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Creating Formats

    All files are simply bytes on a disc. Any application can write bytes to a disc, so any application can create a file of your type, AS LONG AS IT KNOWS THE FORMAT. The file extension is just a way to tell Windows and other applications how to handle a file. It doesn't actually change the file itself. If you change the extension of a Word document to ".xyz" then Windows won't know it's a Word document but it still is. If you open Word and point it to that file it will open it up as normal. Any other application can read or write a compatible file as long as it understands the format.

    Mnay binary file formats are very complex, so working out the spec by reverse engineering is difficult. Microsoft have released the spec for Office file formats publicly, so anyone can create applications that can read or write Office documents. The same goes for the PDF format and many others. Sometines you need to pay a license fee if you want use a proprietary file format.

    So, to you. You can define your file format any way you like. It might be binary or text. Unless you put measures in place anyone will be able to read, write and otherwise use your file format. That's assuming they'd have a reason to do so, which is unlikely. The file extension will indicate to Windows that it's a file of your type, so it will then use the registered file association to open your application when the user executes a file of that type. Other than that a file is just a file and any app is free to make anything it wants of any file.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width