Board index » delphi » File associations - for example - loading prog to display bmp files

File associations - for example - loading prog to display bmp files

All,

        I dont know if this is simple or difficult, or even in the right section
really, however, I need to write software that when a user double clicks a bmp
it loads my software, also if the software is running, it loads into the
software.
        Being an old dos programmer, I thought it would be by paramstr, but
presumably it cant be, otherwise, if the program was already running wouldnt it
just load another copy of the program instead of loading the bmp into the first?

Hope this makes sense! im sure I can think of loads of other uses for such a
function.....but how the hell does it work? code samples would be HEAVILY
appeciated.  BTW D4/W98

SturdySteve

 

Re:File associations - for example - loading prog to display bmp files


You need to create an entry in the registry as for the extension of your
file.  IE..

  HKEY_CLASSES_ROOT\.test

Set its (default) value to a string which uniquely identifies the file type
..

   (Default) = "ABC123"

Create a new key within here ..

   HKEY_CLASSES_ROOT\.test\ShellNew

The new key needs to contain one of the following (its purpose is explained
alongside) ..

   NullFile        (empty string - Only if your application can handle Empty
Files)
   FileName    (string containing path to a template file)

Create another Registry Entry whose name is what you entered above.  IE ..

  HKEY_CLASSES_ROOT\ABC123

Set the (default) value for this to show what type of file the user is
looking at.  IE ..

   (Default) = "A Test Document Type"

Create a DefaultIcon value with a path to a ico or a dll.  If it's a path to
a dll, include a index number ...

   DefaultIcon = "C:\WINDOWS\TEST.ICO"
   DefaultIcon = "C:\WINDOWS\TEST.DLL,1"

Create another key in here ..

   HKEY_CLASSES_ROOT\ABC123\shell\open\command

set the (default) value to the path to your program

   (Default) = "C:\TEST.EXE"

Regards,

Dan Donoghue
DSoft Computer Software

Quote
SturdySteve wrote in message <374a9223.2583...@news.force9.net>...
>All,

> I dont know if this is simple or difficult, or even in the right section
>really, however, I need to write software that when a user double clicks a
bmp
>it loads my software, also if the software is running, it loads into the
>software.
> Being an old dos programmer, I thought it would be by paramstr, but
>presumably it cant be, otherwise, if the program was already running
wouldnt it
>just load another copy of the program instead of loading the bmp into the
first?

>Hope this makes sense! im sure I can think of loads of other uses for such
a
>function.....but how the hell does it work? code samples would be HEAVILY
>appeciated.  BTW D4/W98

>SturdySteve

Other Threads