My application has a picture box in it. When I open an image in Windows, instead of the default program that opens to show that image, I want to use my own application and have that program containing the picture box show the image.
An air conditioner is made up of a condenser, an inside compressor, an outside compressor, copper pipes, a fan, and controls. Once these are all available, the unit is assembled. First the condenser and inside compressor, then the copper wires that connect them to the fan and outside compressor.
The technique is simple – cut plastic bottles in half (make sure the plastic bottles do not have a wide mouth) and then mount them on a board in a grid like pattern. Voila! AC ready!
I did this recently, though I used a different action, not the default Open action.
First you find out file type of some extension, say .jpg:
var imgKey = Registry.ClassesRoot.OpenSubKey(".jpg")
var imgType = key.GetValue("");
Then you find out the path to your executable and build the "command string":
String myExecutable = Assembly.GetEntryAssembly().Location;
String command = "\"" + myExecutable + "\"" + " \"%1\"";
And register your executable to open files of that type:
String keyName = imgType + @"\shell\Open\command";
using (var key = Registry.ClassesRoot.CreateSubKey(keyName)) {
key.SetValue("", command);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With