[Win7] wxMimeTypeManager Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
MoonKid
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 543
Joined: Wed Apr 05, 2006 9:39 am
Contact:

[Win7] wxMimeTypeManager

Post by MoonKid »

On WindowsXP I have this code to register my BFP-files to windows and associate it with my application.

Code: Select all

void BFApp::CheckFileTypeRegistration ()
{
	// the mime types manager
	wxMimeTypesManager mgr;

	wxArrayString arrString;
	// mime
	arrString.Add(wxString("document/") + BF_PROJECT_EXTENSION);
	// open command
	arrString.Add(BFEnvironment::GetDocumentOpenCommand());
	// print command
	arrString.Add(wxEmptyString);
	// description
	arrString.Add("Blackfisk Backup Project");
	// extension
	arrString.Add(BF_PROJECT_EXTENSION);

	wxFileTypeInfo fti(arrString);

	mgr.Associate(fti);
}
On Windows7 it doesn't work. There are a lot of error messages about that registry keys can not be set.
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

Most likely it is also not working on Windows Vista as the security model is basically the same. Applications are no longer allowed to just write in the registry on all places, let alone in the application dir where it is installed. A good thing in my opinion.

Is this code to associate a file type with your app? Why not let the installer take care of that? Doing it yourself can be an annoying feature to users called "extension hijacking" when I specify an extension to be opened by application A, and application B forces that extension to be associated with it, as end user I would be upset. That is, if I understood your purpose correctly.

Using an installer you can let the user specify wether or not the extension is associated, and you also operate in the "administrator mode" because you are installing. making life easier for you..

With regards,
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
MoonKid
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 543
Joined: Wed Apr 05, 2006 9:39 am
Contact:

Post by MoonKid »

Jorg wrote:Is this code to associate a file type with your app? Why not let the installer take care of that? Doing it yourself can be an annoying feature to users called "extension hijacking"
There is still no installer yet.

I know what you mean with "extension hijacking". But the user can decide itself. It doesn't work automatic of course!

Ok, the installer need a piece of code, too. I aks again: How can a associate a file type with an app?
Post Reply