Register a File Type with Windows

I've written an MFC applicaton which has it's own file type and I was wondering how to have my program register the file type with windows and assign an Icon to the file types.
Thanks
trip42Asked:
Who is Participating?
 
VAM345Connect With a Mentor Commented:
In you InitInstance() chesk for

        // Enable DDE Execute open
      EnableShellOpen();
      RegisterShellFileTypes(TRUE);

after call all
        AddDocTemplate(pDocTemplate);

If not add.


Check for correct IDR_ in you doc templetes.

Before return InitInstance add
      m_pMainWnd->DragAcceptFiles();
If you ask accept Drag&Drop of you files.

You see icon after start program.
0
 
thresher_sharkCommented:
Look into the function RegisterShellFileTypes (a CWinApp function).
0
 
thresher_sharkCommented:
I do believe it does exactly what you want.
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
thresher_sharkCommented:
Also look into EnableShellOpen (also a CWinApp member function).
0
 
gcauthonCommented:
All you have to do is create the registry keys.

HKEY_CLASSES_ROOT\.ext = appname
HKEY_CLASSES_ROOT\appname\DefaultIcon = fullpathtoapp.exe

They don't take effect until you reboot.
0
 
thresher_sharkCommented:
VAM345, I suggested using those functions in my comments.  Why did you post it as an answer?
0
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.