Get the defaults programs - c++

i use c++ and qt for a project.
I would to know how i can get the default program : default navigator, default mail client, default editor ...
I found for Linux - Gnome: gconftool!
What is for Windows, Mac Os or Linux (KDE) ?
Thanks you.

If you look at the documentation for QDesktopServices::openUrl() you will see that:
If a mailto URL is specified, the
user's e-mail client will be used to
open a composer window containing the
options specified in the URL, similar
to the way mailto links are handled by
a Web browser.
So using QDesktopServices::openUrl() you should be able to open both the default navigator and default mail client.
I assume you want to open these applications and not just find out what they are.

On Windows this kind of stuff can be recovered directly from the registry (regedit).
Search the web to find out the specific registry paths, like this.

According to Microsoft you should not use the registry directly.
See : http://msdn.microsoft.com/en-us/library/windows/desktop/cc144154(v=vs.85).aspx

Related

download and run exe from chrome browser using c++ plugin

I have a webpage where when I click a button, it should download an exe from a url and the exe should get automatically invoked without user intervention.
In Internet Explorer I achieved this through activex control ( .ocx ) deployed as a .cab file.
I am planning to extend this to chrome and firefox platform too. ( atleast chrome for the first step ).
I don't want to use Java applet ( need to remove java dependency ). I know I could achieve this through Firebreath plugin but clearly this is not a good time to dive into NPAPI plugin ( since NPAPI is already being fading out. Chrome has begun phasing out NPAPI ).
When I looked into alternative Plugin technologies to NPAPI, I stumbled upon Google Native Client. On further reading I got to know Nacl too won't fit my needs since os calls api will not work in nacl ( I hope URLDownloadToFile api or createprocess or shellexecute wouldn't work. Correct me if I am wrong ).
Should I go for Native Messaging? Is there anyother alternative technology am missing ? Guide me Please .
NPAPI until it goes away will let you do what you want; other than that Native Messaging is the only option.
As others have mentioned, this is a Really Bad Idea(tm).
Thanks all the people . I finally settled with Launch Application Using Custom Protocol Handler . http://msdn.microsoft.com/en-us/library/ie/aa767914(v=vs.85).aspx . This fitted my needs .
As suggested above, Chrome's native messaging appears to be the way to go - on Chrome.
First, have a look here: This blog entry shows that native messaging can be used to launch "calc.exe". I've yet to try it myself - but it looks promising:
https://plus.google.com/+FrancoisBeaufort/posts/jdTrmmZL9Xh
One thing to keep in mind is that the Native Messaging technique will only work from a Chrome Extension, which opens up an entire set of related questions.
(1) Can Chrome extensions be installed for all users using group policy? or via the registry?
-Yes, according to http://www.chromium.org/administrators/pre-installed-extensions
Later edit: only "published" extensions can be added via the registry. see - https://developer.chrome.com/extensions/external_extensions
(2) Can you detect whether an extension is already installed?
-Yes, Chrome Extension: How to detect if an extension is installed using Content Scripts
So maybe its possible to have a two-phase process:
-Your users will head to the web page, which will test for the extension (using #1 above)
-If its not there, have the users download and install the .exe (this will require interaction).
-The .exe will deploy the extension files and register it for Chrome (using #2 above)
-On subsequent visits, the already-installed extension can be used to launch/communicate with the now-already-installed .exe (using Native Messaging)

Creating a manifest file inside of /Library/Google/Chrome/NativeMessagingHosts requires super user permissions

This is on Mac 10.8
I have written Google Chrome Extension and a Native Messaging executable which communicates with the Chrome Extension using Native Messaging. All works fine with my Proof of Concept as part of development.
Issue is that now I want to get it deployed.
I have my in house installer which by which I need to create a com.my_company.my_product.json manifest file inside of this /Library/Google/Chrome/NativeMessagingHosts directory which cannot be accessed unless I ask for the password of the admin user.
I am doing this port as part of migration of NPPlugin to Chrome Extension Native messaging communication which will replace the NPPlugin. NPPlugin can be accessed from both /Library as well as ~/Library which does not require sudo permissions.
Why does the manifest file need to be at root /Library level ad not user ~/library level? If so how can we get this installed on a Mac without bothering the user with admin password which the user will obviously be less likely to share.
If anyone has a solution, the Native Executable is a C++ program that can use Mac API calls.
Your understanding is correct. The Chromium team is investigating user directories as an additional option. Ensuring continuing security is the primary concern. I'll update this answer when there's more to report. (Update 6/1/2014: see Rob W.'s comment to this answer)

Embed specific Web Browser in C++ application

my question might be crazy, I know it has to be something like COM, but I need to include and COM a specific version of Web browser in my application no matter what version of the browser the computer currently is using, say to include IE7(dll file or whatever) in the project and COM programming it as a window in C++ application to surf web pages on internet although the default browser in client machine is IE9. And deploy the compiled project with IE7 file(s) to client machines. If IE/COM won't work that way, any other browsers can do the tricks?
Many Thanks!
CanadaYong
No, you cannot "embed" a specific version of Internet Explorer in your application. But you probably don't need to: when you use the IE COM WebBrowser Control in your application, by default it runs in IE7 Compatibility mode. Later modes are only used if you explicitly set the FEATURE_BROWSER_EMULATION registry key listing your executable name.

C++ change Opera proxy settings

I'm writing an http proxy program in C++ and I need it to automatically configure the default browser proxy settings to use my proxy. With IE i can just modify the registry, Chrome has a command line parameters that can be used, firefox has the prefs file, but I can't figure out how to do it for Opera. It needs to be compatible with all versions, so PAC files are out of the question. Any help is appreciated.
Just in case you had problems with with IE, apparently on Windows 7 you can't just modify the registry.

How to check if specific web browser is installed on system?

How to check if specific web browser (chrome, firefox, opera) is installed on system? (C++/Windows platform). Maybe this can be check in somewhere in registry?
Like Andrey says, there is no way to detect everything
You should probably start off by looking for browser specific registry keys:
HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox
HKEY_CURRENT_USER\Software\Opera Software
then move on to
<HKEY_CURRENT_USER|HKEY_LOCAL_MACHINE>\SOFTWARE\Clients\StartMenuInternet
and finally
HKEY_CLASSES_ROOT\HTTP and HKEY_CLASSES_ROOT\.htm[l]