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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Associations

Status
Not open for further replies.

VBGuyUsingVC

Programmer
Jan 10, 2002
24
0
0
US
Does anyone know how to get a list of the registered file formats. I want to be able to do something similar to the way Windows displays the file types. (You know, a windows comes up listing all the executable titles and associated extensions with them.) . Is this simply a painful registry look up or can I use some APIs. Any help would be appreciated.
 
In the registry you mast have to create the entries:

HKEY_CLASSES_ROOT\.{Your extension}\{DefaultValue}
then

HKEY_CLASSES_ROOT\{DefaultValue}\DefaultIcon
(for the explorer icon)
HKEY_CLASSES_ROOT\.{YourExtension}\Shell\Open\Command
Value = "YourProgram.exe %1"


For example:
HKEY_CLASSES_ROOT\.ocx\ocxfile
HKEY_CLASSES_ROOT\.ocxfile\DefaultIcon
Value=%SystemRoot%\system32\shell32.dll,-154


Also look for API and MFC function RegisterFileTypes()

HTH,

s-)

Blessed is he who in the name of justice and goodwill, sheperds the weak through the valley of darkness...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top