Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Associate extensions to my app

Status
Not open for further replies.

LastCyborg

Programmer
Feb 7, 2003
256
MX
How can I associate certain file extensions to be open with my application?
like .doc with MS Word, .txt with notepad, etc

--- LastCyborg ---
 
You need to create a set of registry entries to register a new filetype. Most vital entries are shown below.

HKEY_CLASSES_ROOT
|_.ext
| (Default) = MyFileType
|_MyFileType
| (Default) = Description that appears in Windows Explorer
|_DefaultIcon
| (Default) = PathOfIconFile,Index
|_Shell
| (Default) = Open
|_Open
|_command
(Default) = commandline

See the following article on MSDN for complete details;

Note that you need to call the SHChangeNotify function with SHCNE_ASSOCCHANGED event to let Windows know that you have changed/modified the file associations, otherwise Windows might not notice that change unless you restart your windows session.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top