win32 file type associations

Started by
2 comments, last by foofightr 19 years, 11 months ago
Is there a way to programatically access the Win32 file type associations in a similar way to typing FTYPE and ASSOC in a console window? I know the info is stored in the registry under HKEY_CLASSES_ROOT, but it''s not stored consistently (there are many discrepencies), so it''s a hassle to extract information out of it. For example, if I want to programatically open a .x file in the default text editor, I access the registry under HKEY_CLASSES_ROOT/txtfile/shell/open/command and see that it''s "C:\Windows\System32\NOTEPAD.EXE %1" after expanding environment strings. That''s all well and good for text files, but many other file formats are not stored so conveniently. Is there a way to use the Win32 API to ask "what program is associated to suchandsuch file type" instead of digging through the registry and trying (and failing) to account for all the discrepencies? And it''s not just a case of doing system("start test.x"); as that will open it with DirectX Mesh Viewer.
Advertisement
FindExecutable()

Thanks Salsa!Colin Jeanne | Invader''s Realm
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud
Well I''ll be damned. I went through MSDN with a fine tooth comb, and turned up nothing.

Thanks.
quote:Original post by foofightr
Well I''ll be damned. I went through MSDN with a fine tooth comb, and turned up nothing.

Thanks.

I found the function by searching for information on ShellExecute(). I figured that if such a function existed since it was related to ShellExecute() it is probably mentioned around it.

Thanks Salsa!Colin Jeanne | Invader''s Realm
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud

This topic is closed to new replies.

Advertisement