Solved

Register a File Type with Windows

Posted on 1998-09-07
6
168 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
Comment Utility
Look into the function RegisterShellFileTypes (a CWinApp function).
0
 
LVL 6

Expert Comment

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

Expert Comment

by:thresher_shark
Comment Utility
Also look into EnableShellOpen (also a CWinApp member function).
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Expert Comment

by:gcauthon
Comment Utility
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
Comment Utility
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
Comment Utility
VAM345, I suggested using those functions in my comments.  Why did you post it as an answer?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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++.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now