Thread: extensions

  1. #1
    Registered User canine's Avatar
    Join Date
    Sep 2001
    Posts
    125

    extensions

    how can my program tell windows that a certain file extension opens with my program?
    In a perfect world every dog would have a home and every home would have a dog.
    Visit My Web Site, Canine Programming
    I use Win32 API

  2. #2
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    have your program edit

    HKEY_CLASSES_ROOT/.FileType

    to have the path of your filename in the default key. I think wc.hIconSm is the picture shown on the icons for files opening with your program, but I'm not sure.

  3. #3
    Registered User canine's Avatar
    Join Date
    Sep 2001
    Posts
    125
    hmmm. i can't get it to work. could i have an example?
    In a perfect world every dog would have a home and every home would have a dog.
    Visit My Web Site, Canine Programming
    I use Win32 API

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Okay...

    do this with regedit first and then you can look at it with registry functions

    Your proggie needs to be able to accept a file name as an arg to WinMain and then open it when excecuted.

    Open regedit and go to the HKEY_CLASSES_ROOT. Create a new subkey called "mywinfile". Under this create a subkey called "shell" and under this another subkey called "open". Under that put yet another key called "command". In the default entry of command, type the path of your app followed by "%1". So it will look like "C:\myprog %1".

    Therefore your key will look like;
    Code:
    HKEY_CLASSES_ROOT
              |____mywinfile
                           |____shell
                                      |____open
                                            |____command
    with the default entry of "command" edited as above

    Now, under HKEY_CLASSES_ROOT, create another subkey and name it with the extension you want your app to open. For instance if you want to open .mywinf, you would name the key ".mywinf". Now under the default of this key enter the name of the other subkey - "mywinfile".

    now when you rightclick "somefile.mywinf" you get an open option and as long as your prog is setup, it will open

  5. #5
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    Go to start, settings, folder options (if you don't find it there, its in control panel). Then click on the 'File Types' tab. Then find the file type that you want then edit it so that it uses your program to open a file of that type.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Choosing a compiler
    By pushingsquares in forum Game Programming
    Replies: 27
    Last Post: 12-14-2006, 10:33 AM
  2. managed extensions
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 06-25-2003, 11:39 PM
  3. File Extensions
    By Polymorphic OOP in forum C++ Programming
    Replies: 2
    Last Post: 01-29-2003, 05:43 PM
  4. anyone know about interrupt 13h extensions?
    By merlyn2000 in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 06-17-2002, 11:00 AM
  5. different file extensions in the Directx SDK
    By Crossbow in forum Game Programming
    Replies: 3
    Last Post: 12-11-2001, 11:25 PM