To be able to write to the key UserChoice i needed to take ownership of the key before writing to it. I used code from the following link:. The other keys like HKCR are shortcuts that show a section of the two root keys. Ask a question. Quick access. Search related threads. Remove From My Forums. Answered by:. Archived Forums. Also discuss all the other Microsoft libraries that are built on or extend the. Sign in to vote. I'm trying to associate file extension to start some type of files with my application.
Which registry keys I have to modify to be sure, that when user double click at file it opens with my application. This key created after setting default program by "Open with" dialog.
Write, r. Name ; f. Assert ; r. Thursday, December 24, PM. It comes from Windows 3. Of course you could manually open each sub key, manually create the ProgID and extension subkey, and then set the key value, but a nice thing about the SetValue function is that if the keys or values don't exist, they will automatically be created.
Very handy. Now, a quick word about which hive to use. I don't recommend doing this. Therefore, you should take this into consideration when designing your application.
However, that file association setting will only be loaded for the current user, and if your application has been installed for all users, your application won't launch when that other user opens the file in Windows. Below is part of the program written in c which associate file extension. And I believe Microsoft recommends the second practice- because it's what the built-in "open with" is doing.
Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 12 years, 4 months ago. Active 4 months ago. Viewed 93k times. Improve this question. Seth Seth 7, 13 13 gold badges 68 68 silver badges bronze badges. Add a comment. The overarching question is really about how to have non-shared resources both write to a shared resource. But in the case with the Windows registry and file associations in general, your file can only be associated with one program.
That is, double-clicking on the file can only open one program unless some other intermediate system decides otherwise.
Windows Vista introduced such a system. Registry object, check out this link MSDN. CreateSubKey ". SetValue " " , " ext" , Microsoft. String 'where ext is your extension My. SetValue " " , Application. String '"" tells the application to set the key's default value. ExecutablePath tells the code to associate your running app with this file type.
Hope this helps a little Kind regards TSB. Hi Dylan,. Question: How to create a file extension and associate the extension with your application? TSB is right. Thank you TSB for your friendly help. Please check the following example and tutorial: 1. File Association in VB. NET using the third-part component: Registry Actions.
0コメント