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

x
?
Solved

Register a File Type with Windows

Posted on 1998-09-07
6
Medium Priority
?
181 Views
Last Modified: 2010-04-02
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
0
Comment
Question by:trip42
  • 4
6 Comments
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1172133
Look into the function RegisterShellFileTypes (a CWinApp function).
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1172134
I do believe it does exactly what you want.
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1172135
Also look into EnableShellOpen (also a CWinApp member function).
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Expert Comment

by:gcauthon
ID: 1172136
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
 
LVL 1

Accepted Solution

by:
VAM345 earned 200 total points
ID: 1172137
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
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1172138
VAM345, I suggested using those functions in my comments.  Why did you post it as an answer?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question