How can I get Win-10 to allow me to choose as a default app, an app that I have put on the machine (a VM) into the Program Files folder?
-- For me leaving the EU has always been a fundamental if abstract question of democratic accountability: disliking a transnational government it's impossible to kick out.
Iain Martin - The Times 24/11/2022
Didn't find your answer? Ask the community — no account required.
R
Roger Mills
Not quite sure I undersand what you want to do. Are you saying that when, in W10 Exploder (or similar), you double-click on a file of a specified type, you want it to open in an app installed on the VM rather than on the W10 host?
If I've interpreted your question wrongly, please clarify what you *do* want to do.
T
Tim Streater
The VM (a VirtualBox VM running on my Mac) is what is running W10.
I have put an app in Program Files. This app can handle the URI. I want to be able to get to a situation where, if in (say) Firefox a user clicks on a website link that is a mailto URI, then rather than opening Windows Mail or Thunderbox, it sends the mailto URI to my app and opens that instead. I already do this for the macOS version of my app, by the simple expedient of having my app be the default app for email on my Mac. Simples.
Now, if I go to the Win-10 System Settings and eventually find that for Default Apps, all the things are listed there that you'd like to be able to set a default app for - browser, app to handle pdf and so on. There's one for email, too, but not only is my app not listed as an option to select for the email entry, there's no apparent mechanism to *make* it be so listed.
Poking around on the Internet leads me to uncountable "solutions" all suggesting a different registry entry to add but warning that there's an unknowable hiearchy of these things in the registry. There must be a better way.
(Under Linux I get slightly further - the mailto link in (say) a Firefox web page can start my app but passes no information to it).
T
Theo
That means you need to set a URI handler for the mailto: scheme. Looks like this will do it:
formatting link
linked from (which has pictures):
formatting link
Those are handlers for *file types*. You could set one for .eml so somebody clicking on a mailbox file in Explorer opens it in your app, but that's entirely a different thing from a URI handler.
There are other ways that appear to apply if you're a UWP app, but there may not be an API for it if you're a Win32 app.
Theo
T
Tim Streater
Ah, that looks promising but probably better attempted tomorrow. Ideally I'd like the app to register itself, which I believe should be doable. But I'll get a working entry first.
In Linux Mint I can get Firefox to accept my app as the mailto handler, and it starts the app when a link is clicked, but so far I havent found out how to edit the string that is passed - I need to add %1 or similar.
OK - that makes more sense now - thanks.
J
John Rumm
Right click on the file, and select "open with". There should be a choice apps it can find on the machine. If you don't see yours there use the "Look for another app on this PC" link. Then you can browse to the app's executable and select that. Tick the box to say "always use this app" and it will remember in the future.
T
Tim Streater
It's not a file; it's the URI. Anyway Theo has made a suggestion I'll try later.
J
John Rumm
Accessed in which browser?
T
Tim Streater
Firefox.
J
John Rumm
I expect you have a double act of players here there. FF has a file in the profile called handlers.json. This is what you see in the General->Applications bin in settings in FF.
That looks like it pulls in registry information from the \HKEY_CLASSES_ROOT hive in the registry. That links many file types and URIs etc to their handlers.
So your app installer would need to create a new key under that root, then add additional key under that. Vis:
HKEY_CLASSES_ROOT\TimsApp
Then create the sub keys:
HKEY_CLASSES_ROOT\TimsApp\shell\open\command
And make a default entry in the command key by adding a string in the format "path to executable" "%1"
%1 will get substituted for the full URI when the command is executed.
T
Theo
If I understand the MS page correctly, you need to call this subtree the HKEY_CLASSES_ROOT\mailto to get it to respond to the mailto: protocol (not the TimsApp: protocol), and then set an empty string for HKEY_CLASSES_ROOT\mailto\URL Protocol to enable it as a URI handler. Then HKEY_CLASSES_ROOT\mailto\shell\open\command is the name of the binary to run and any parameters, and HKEY_CLASSES_ROOT\mailto\DefaultIcon is a file to pull the icon from (could be the same .exe)
That's how IE did it, but I'm guessing that other Windows browsers also look at the same keys. Of course there might also be a FF specific config, but I suspect Tim wants to have a way to set his program to be the default mailto: handler across all browsers.
Theo
J
John Rumm
The "TimsApp" was just a place holder for whatever his app was (I had not assumed it was a mailto handler he needed)
So yes adjust the name to match the name of the protocol you are trying to create the handler for.
The FF specific config will let it ignore the "default" system one if you want... so there will likely be a .pdf handler specified, by in FF you can choose to take a different action like chose a different program, or ask the user at the time, or just save it etc.
T
Tim Streater
Looking with regedit in my Win-10 VM, this much already exists. The keys with mailto are:
Pretty much. What I'm after is that my app be able to register itself as a handler, so a user would then have the option to choose it in the browser of their choice (and perhaps another app in another browser).
For the moment I've added shell\open\command with command having the string:
"C:\Program Files\MyApp\MyApp.exe" "%1"
However, when I try a simple hml file containing a link, Nothing Happens. And looking in Firefox, I can select MyApp but the associated string is missing the argument component.
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.