Thread: Creating my own file extension

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    3

    Creating my own file extension

    What i want to know is
    A: how do i make a program run by double clicking an icon (as is normally how you activate a program), but i need to somehow attatch my program to the extension i use.
    and B: once i run the program i would need it determine the file name of the file i double clicked without me having to define it.

    The extension is for my own bitmap kind of image file (it is simpler than others and is purely for my own use), i would basicly want to start my program with the file i double click being the loaded file... just like if i were to open a text file.... its just a matter of figuring out the name of the file being opened.

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    http://msdn.microsoft.com/workshop/n...appendix_a.asp

    In HKEY_CLASSES_ROOT, you create a key that contains the extension you want. A default (empty string "") value in this key should be set to your classname "MyBmpThingy". Then, create HKEY_CLASSES_ROOT\MyBmpThingy\Shell\Open\Command and make default ("") value of "\"C:\\Path\\To\\Yr\\Prog\" \"%1\"". You will need the win32 registry api to do this, and permission to modify the registry, and special precautions taken when dealing with the registry (not liable)

    http://www.google.com/search?q=registry+api
    http://msdn.microsoft.com/library/de..._functions.asp

    Or search the internet/forum for file associations. People do this and make code for you to use and make big smiles for yoo.

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    3
    That doesnt sound like fun, lol... but thanks for the information, i will try to see if can do that.

  4. #4
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    There are fun ways too. Just search file associations on google. That's how you'd do it programmatically. I didn't realize that this was not on the coding board, and you might want to look at these

    http://support.microsoft.com/default...307859&sd=tech

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  2. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  3. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  4. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  5. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM