File type association using c or c++

Associate the file type to my own exe

if my extension is ".ex"
if i double click the file with extension ".ex"
i should open with "myapp.exe"
Who is Participating?
SreejithGConnect With a Mentor Commented:
You need to Associate File Extension with Shell OPEN command

sample available in
NaveenKhannaAuthor Commented:
thanks for the reply
pls provide me c example
You could add new file extensions and their associated application by using the explorer. Right-click at a file with that extension, choose the 'Open with ...' menu item, and make the settings that for the given file type always your application should be used. At the command line (dos box) you can do the same using the ASSOC command (type assoc /?).

To open the file using your app after association use

ShellExecute(NULL, "open", full_path_of_file, NULL, "", SW_SHOW);
NaveenKhannaAuthor Commented:
thank you
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.