Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

Associating File Extentions

How do I associate a file extention with my application in windows 95?

Example:
BMP is associated with Paint.exe.
when you double click on a *.bmp image, paint is launched with the corrosponding bmp loaded.

I would like to associate the extention *.USER with my application.
0
sleach
Asked:
sleach
  • 3
1 Solution
 
javiertbCommented:
Is this a Delphi question or a win95 one?

I guess it's the second one. Just Shift+RightClick on your *.USER  file and the select 'Open With...' . Finally select the application you want to be called everytime you click on a *.USER file.

Programatically it would look something like this:
 
ShellExecute(0,'Open','c:\apppath\yourAPPLICATION.exe',              'c:\filepath\file.USER','c:\apppath',SW_MAXIMIZE);
 


0
 
gysbert1Commented:
I Assume you want your program to do the association automatically upon install.

I wouldn't say javiertb's method is te best way to do this. It is definitely not the CORRECT way.

You should make an entry in the system registry to associate files in Win95. You could also check if your extention is already associated with something else and then change that if you want.

javiertb's method will not work with .bmp for example since it is associated with another program already !

Drop me a comment if you need help doing this ...
0
 
javiertbCommented:
I know it's not quite the CORRECT way but I didn't exactly know what you were trying to do.
If you want to change the registry by code to enable it to open your files, you will have to create two entries :

- HKEY_CLASSES_ROOT\.USER  --> (Default)= myextension
- HKEY_CLASSES_ROOT\Shell\Open\Command --> (Default) =                                            c:\path\myfile.exe %1

You'll be able to do this via TRegistry component. Look up delphi online help.  

0
 
javiertbCommented:
Ooops, mistake:

the second key should be

- HKEY_CLASSES_ROOT\myextension\Shell\Open\Command -->
  (Default) = c:\path\myfile.exe %1
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now