Advertisement Jump to content


This topic is now archived and is closed to further replies.


win32 file type associations

This topic is 5370 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post

Link to post
Share on other sites
Original post by foofightr
Well I''ll be damned. I went through MSDN with a fine tooth comb, and turned up nothing.


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

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!