How to make file to be opened by my app? [duplicate] - c#

This question already has answers here:
Where does Windows store its "Open With" settings?
(3 answers)
Closed 9 years ago.
I have a little bit confusing problem. I'm not a beginner but I don't know how to do it..
For example I've written a program like notepad from which you can open files, save and etc. But when I set any custom format like ".blabla" to be opened by my app it is not working, so how can I make it to be opened by my app?
It is in WinForms

You need an entry in the registry for custom file extensions. You can try inserting a key in the registry as follows:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\

Related

How to get a WPF app to open another app if it exists [duplicate]

This question already has answers here:
Check if an executable exists in the Windows path
(8 answers)
Closed 3 years ago.
I am working on a WPF app, and I would like to include a button that directs it to another app. I would like it to have the following functionality:
If the app is installed on the user's computer, it opens the app for them.
If the app is not yet installed, it sends them to a link where they can download the app.
I know I will need to use Process.Start to open the app, but I am stuck on how to check if the app exists. If anyone could point me in the right direction it would be appreciated!
Two things you can use:
File.Exists(string) - Checks if the file exists.
try-catch - Simply try to open it, and handle any exceptions.
I would probably opt for the first solution...

How to "pull" an existing pdf into the app? [duplicate]

This question already has answers here:
Display a PDF in WPF Application [closed]
(9 answers)
Closed 3 years ago.
I currently have an app in C#/WPF, and I have a manual on how to use it in pdf, and I'm thinking of adding a button that when clicked open the manual ... How can I do this?
Process.Start("C:\Temp\yourname.pdf");
replace the string "C:\Temp\yourname.pdf" with the path and filename for the pdf file you want to open.
This will cause the pdf to open in your systems default pdf application.
You will need: - using System.Diagnostics;

How can I establish my windows form application (c#) as the principle application to open a file extension? [duplicate]

This question already has answers here:
Windows file associations done properly?
(1 answer)
How to associate a file extension to the current executable in C#
(9 answers)
Closed 6 years ago.
I have a windows form application made in c#, and I want to set a file extension (.txt for example) to open automactily with my application and my icon instead of the NotePad. How can I do it?

C# launch power options [duplicate]

This question already has answers here:
How can run functions of powercfg by C# code?
(3 answers)
Closed 9 years ago.
From my C# program I want to open the power options from the control panel in Windows.
However I can't seem to find out how to do that, I tried making a shortcut and see where it goes but it is referring to the control panel.
Does anyone have an idea how to do that or where the exe is located to launch?
Try the following:
System.Diagnostics.Process.Start("powercfg.cpl");

C# class similar to Java Desktop class [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Open file with associated application
I want to open a file in it respective application, e.g. open function of windows.
Same thing can be done in java with the help of Desktop class where you pass the file name and the respective file is opened.
But no idea how to do in C#.
System.Diagnostics.Process.Start("filename.doc");

Categories