הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
Question
Tuesday, October 24, 2017 3:17 PM
I want users of my program to select a button to set WordPad.exe as the default program to edit .RTF files. How do you do that?
Robert Homes
All replies (9)
Tuesday, October 24, 2017 3:47 PM | 1 vote
Out of curiousity, why would you need to do that? Are you trying to run wordpad to open rtf files from your app?
If you say it can`t be done then i`ll try it
Tuesday, October 24, 2017 3:54 PM
Hi Iron :) I replied to you here "https://social.msdn.microsoft.com/Forums/vstudio/en-US/3af30004-7c66-4e60-8cc6-c0b29eb22f9b/integrating-external-excecutable-file-in-windows-form-help?forum=vbgeneral#fc46a476-44c9-4c50-b683-71327c8b72a2" I've been waiting 3 hours for your help. Thanks again in advance!
Tuesday, October 24, 2017 4:15 PM | 1 vote
Hi Iron :) I replied to you here "https://social.msdn.microsoft.com/Forums/vstudio/en-US/3af30004-7c66-4e60-8cc6-c0b29eb22f9b/integrating-external-excecutable-file-in-windows-form-help?forum=vbgeneral#fc46a476-44c9-4c50-b683-71327c8b72a2" I've been waiting 3 hours for your help. Thanks again in advance!
I just got home from work a little bit ago so, please be patient. I can see that you asked something more in that thread and will try to get to it when i have a few minutes.
If you say it can`t be done then i`ll try it
Tuesday, October 24, 2017 4:15 PM
To IronMan: My program uses Word to manage certain files. I have another set of files that I don't want to mix with the Word files. Using Wordpad for those files keeps them out of Word and keeps them from getting mixed up with the files the program is primarily working with.
Robert Homes
Tuesday, October 24, 2017 4:29 PM | 1 vote
My program uses Word to manage certain files. I have another set of files that I don't want to mix with the Word files. Using Wordpad for those files keeps them out of Word and keeps them from getting mixed up with the files the program is primarily working with.
Robert Homes
I don't understand what this has to do with setting .rtf files to use wordpad as the default program to open them. This would be the choice of the computer owner/user as to what program they want to open .rtf files by default and would not recommend changing that.
Again, are you trying to open some .rtf files from withing your application and it is using MS Word to open them by default? If so, then you can just use the Process class to open WordPad and supply the filename as an argument. For example, this will open Wordpad and load the "MyRtfFile.rtf" file.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Process.Start("wordpad", Chr(34) & "C:\TestFolder\New folder (2)\MyRtfFile.rtf" & Chr(34))
End Sub
If you say it can`t be done then i`ll try it
Tuesday, October 24, 2017 4:31 PM
Please, please take your time. Answer it tomorrow if you wish. I'm not demanding of it :P. I'm just thankful for the help!
Tuesday, October 24, 2017 4:38 PM | 1 vote
Robert,
Forgot to mention.... If this is only for you to use on your own computer, then you can just right click on any rtf file and select (Open With...). There you will see the option to choose the default program to open rtf files on your computer. 8)
If you say it can`t be done then i`ll try it
Tuesday, October 24, 2017 8:28 PM | 1 vote
Older versions of Windows (e.g., Vista and Win7) provided the ability to programatically set default programs using the IApplicationAssociationRegistration interface. However, as this link notes, this functionality was removed from the interface beginning with Windows 8. Windows philosophy frowns upon programs setting defaults that ordinarily should be chosen by users through UI interaction. Further to this, see Default Programs.
If you intend to use Wordpad as the default program for RTF files on your own system then you can set it as the default using existing Windows UI. However, this isn't something that should be done by an application on someone else's computer, even on older systems where the API to accomplish it is available.
Wednesday, October 25, 2017 3:25 AM | 1 vote
Hi Robert,
By my search, I don't find any info about setting the default program to open a chosen file type in vb.net. As IronRazerz said if you want to open .RTF file using default program, you can right-click the file and choose open with to use the program that you want.
Best Regards,
Cherry
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.