Greg There's something that was loaded up to Channel9 in 2006 (here <http://channel9.msdn.com/Forums/Sandbox/249856-System-File-Association> ), and also some 2009 code, corrected in comments up to 2012, to manipulate the registry (here <http://mel-green.com/2009/04/c-set-file-type-association/> ) - which I will test out. I probably need to run up a VM to test it else I will risk stuffing up this particular desktop's file associations. And I want to be able to reverse them, of course.
_____ Ian Thomas Victoria Park, Western Australia From: [email protected] [mailto:[email protected]] On Behalf Of Greg Keogh Sent: Wednesday, August 21, 2013 5:29 PM To: ozDotNet Subject: Re: Programmatically set default program for file type Hi Ian, when I started using Vista I noticed the file association tab has vanished, so as a weekend exercise I wrote a WinForms app that lists and assigns associations by setting registry values and pulling icons out of PE resources with the API. I just had a look at the huge morass of code and I can't decipher the tiny internal bit that does the actual work. The number of reg keys to tweak is quite small. If you get stuck, let me know and I'll have a fresh look in the morning. The app couldn't make changes unless it was running elevated, and I had some code in there to check for that and graciously degrade -- Greg On 21 August 2013 18:59, Ian Thomas <[email protected]> wrote: I would like to set the default program that runs a particular file type in code (in my application, to set VLC Media Player for .MP4 files). As far as I know there aren't .NET classes for file associations - so is it via registry keys that I do this? Prior to coding I have tested my Windows 7 desktop as a Standard User, with the control panel applets (Default Progams - first 2 options) But my changes don't "stick" as Standard User (OK as Admin); it reverts to WMP as the default for .MP4 files. _____ Ian Thomas Victoria Park, Western Australia
