Solved

Register a File Type with Windows

Posted on 1998-09-07
6
174 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 100 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

734 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