Registering file types - dialog-based app.

How do I register one or more file types (*.ABC, *.XYZ) with my own dialog-based application ? I need to              extract the name of the double-clicked file, launch the program and execute a default action.

I know where to find documentation on "Manipulating the Registry" for SDI/MDI applications, but my program is dialog-based and, of course, behaves "differently".

                    Thanks in advance.

                    Pawel Tokarczuk
Who is Participating?
jaguar_sriConnect With a Mentor Commented:
Hai there
  Firstly RegisterShellFileTypes is used
only when you have a document template.
What does RegisterShellFileTypes() do?
It uses a flag that registration should
 be done and then registers all the file
 extensions provided either in the string
 table or when using appwizard.
So if you dont use a doc template then you
 cannot use it.

Same is the case with
ParseCommandLine and ProcessShellCommand.

For  a dialog based application if you
are not using any documents then only way
 is to write your own
modules to register the file types using
various functions like WriteProfileString etc.

The way to do this is probably to look at what an SDI/MDI app does in InitInstance and adapt that code to your situation. I think the relevent functions are... RegisterShellFileTypes, ParseCommandLine, and ProcessShellCommand.

you can register your files manually by editing the file extension entry in the registry under:
create a new key: Shell\Open\command
and enter as value for command yourapp.exe "%1"
this will start your app with the doublecklicked file as parameter.
what will happen with this file must be implemented in the "ParseCommandLine()" Function.
if you want automaitc registration of file type you have implemnet all the functions mentioned by paul.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.