I need to open a dialog window for asking to the user which program he prefer to use for opening a file.
I'm using this code for opening the file with the system preferred application and it works var file = Components.classes['@mozilla.org/file/local;1'] .createInstance(Components.interfaces.nsILocalFile); ..... var ms = Components.classes["@mozilla.org/mime;1"] .getService(Components.interfaces.nsIMIMEService); var type = ms.getTypeFromFile(file); var mi = ms.getFromTypeAndExtension(type, ""); mi.preferredAction = Components.interfaces.nsIMIMEInfo.useSystemDefault; mi.launchWithFile(file); For always open a dialog window I presume I need to use alwaysAsk http://www.xulplanet.com/references/xpcomref/ifaces/nsIMIMEInfo.html so mi.preferredAction = Components.interfaces.nsIMIMEInfo.alwaysAsk; mi.launchWithFile(file); But I received this exception. Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIMIMEInfo.launchWithFile]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE) _______________________________________________ dev-tech-xpcom mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-xpcom
