Solved

Register a File Type with Windows

Posted on 1998-09-07
6
169 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

911 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

24 Experts available now in Live!

Get 1:1 Help Now