Page 1 of 1

[Win7] wxMimeTypeManager

Posted: Mon Nov 02, 2009 6:23 pm
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.

Posted: Tue Nov 03, 2009 7:45 am
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

Posted: Tue Nov 03, 2009 1:56 pm
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?