Adobe Flex OpenWithDefaultApplication Movie - file

I am working on an Adobe Air application that I would like to be able to launch a movie using the default application. The code I am trying is:
var file:File = new File;
//currentMovie.ConfiguredPath = 'D:\\Movies\\TestMovie.avi';
file.nativePath = currentMovie.ConfiguredPath;
file.openWithDefaultApplication();
I have also tried this:
//currentMovie.ConfiguredPath = file://D:/Movies/TestMovie.avi'
navigateToURL(newURLRequest(currentMovie.ConfiguredPath));
The first option does nothing. No application opens, no errors, nothing. The second option worked but it launches a separate window, downloads the file to the local user's download directory then opens the file (as long as you click "Open"). This is not exactly the behavior that I was hoping for.

Related

Open a pdf with default windows behaviour from a WPF application

I want to open a PDF with the default windows behaviour the user has saved (e.g. internet explorer, adobe, whatever).
I found this solution
Opening a .pdf file in windows form through a button click
and implemented it here:
ProcessStartInfo startInfo = new ProcessStartInfo("MyPdfPath");
Process.Start(startInfo);
Sadly I got an Error:
System.ComponentModel.Win32Exception: "The specified executable is not a valid application for this OS platform."
I tried to google this error, but nothing of the first ten solution ideas worked.
The system is treating it like an executable, one way to get the document behavior is to set UseShellExecute to true:
ProcessStartInfo startInfo = new ProcessStartInfo("MyPdfPath");
startInfo.UseShellExecute = true;
Process.Start(startInfo);

SaveFileDialog in WPF on Windows XP shows empty file list

I'm using a Microsoft.Win32.SaveFileDialog in a WPF application which is fine in Windows 10 but some users are still using Windows XP and initially the dialog shows no files.
Changing the file type to another type updates the list. It appears to only be the initial loading.
I've used System.Windows.Forms.SaveFileDialog, using a "Using", making sure the Dialog has an owner Window and using BeginInvoke on the current dispatcher.
lSaveFileDialog = new Microsoft.Win32.SaveFileDialog();
lSaveFileDialog.Title = "Datei speichern";
lSaveFileDialog.InitialDirectory = pFilenameElements.IFilenameElement_DirectoryInfo.FullName;
lSaveFileDialog.Filter = "Word Dateien (*.doc)|*.doc|Alle Dateien (*.*)|*.*";
lSaveFileDialog.RestoreDirectory = true;
lSaveFileDialog.FileName = pSuggestedFilename;
if (lSaveFileDialog.ShowDialog() == true)
{
return lSaveFileDialog.FileName;
}
I expect the Dialog to open and display other Word files in the current folder but it only does that if I switch the filter to "All" and then I see everything. Switching back to "Word" and I see the Word files.
On Windows 10 there is no problem.

Allow only one Chromium app instance

I have the Chromium source on Windows 7, and launch my custom app with the --app="..url" switch through a .bat file. How can I prevent users from opening more than one instance of my Chromium app? This includes opening the .exe directly, using the .bat file and by selecting "Chromium" from the jump list menu on the task bar.
If the app is launched with the --app="...url" flag, then the following solution will prevent further "instances" of Chrome being opened. I say "instances" because Chrome doesn't actually create new Chrome base processes. Instead, it opens a new window with a process used for rendering that particular window.
So, when the app is in --app mode, all you need to do is prevent new windows from opening. This can be accomplished by modifying the OpenApplicationWindow() method within the Chromium source code Application_launch class: chrome/browser/ui/extensions/application_launch.cc.
...
OpenApplicationWindow(const AppLaunchParams& params) {
browser = chrome::FindBrowserWithProfile(profile, params.desktop_type);
#endif
WebContents* web_contents;
if (!browser) {
browser = new Browser(browser_params);
web_contents = chrome::AddSelectedTabWithURL(
browser, url, content::PAGE_TRANSITION_AUTO_TOPLEVEL);
web_contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
web_contents->GetRenderViewHost()->SyncRendererPrefs();
}
else {
web_contents = browser->tab_strip_model()->GetActiveWebContents();
}
browser->window()->Show();
...
*NOTE: There should be some Windows 8 code in this method already. The idea is to remove the conditions for Windows 8 Metro Mode, so new Windows are always prevented.

Can i open directory from jump list

Im writing WPF application and want to add ability to call jump list and open program configuration, app.config or log directory from it. Is it possible(cant find the way to do that..just JumpTasks with application path and JumpPath with path to file, and not just path to be opened via explorer)?
Found answer here. Seems that JumpList wasnt designed for opening anything but files or applications, associated with current program. So that when we see directories in explorer tasklist -it actually means: use explorer with parameters. By the way ill try to use it.
Update
made it with such code:
string explorerPath = #"%windir%\explorer.exe";
JumpTask path = new JumpTask
{
CustomCategory = "Paths",
Title = "Open program directory",
IconResourcePath = explorerPath,
ApplicationPath = explorerPath,
Arguments = #"/root," + AppDomain.CurrentDomain.BaseDirectory,
Description = AppDomain.CurrentDomain.BaseDirectory
};
Im leaving this answer here, because someone can have similar incomprehension.

Open a folder and highlight a particular file with WPF

Is there a way to launch an Explorer window and highlight a file in that folder with WPF ? I've already tried the following :
Process ExplorerWindowProcess = new Process();
ExplorerWindowProcess.StartInfo.FileName = "explorer.exe";
ExplorerWindowProcess.StartInfo.Arguments = ConfigFile.File.FullName;
ExplorerWindowProcess.Start();
... but that opens the file (in my case an XML file) with the default application in Windows Explorer, which I very much don't want. I know that the Aptana tools available for Eclipse allow you the ability to select a file in the Eclipse project browser and show the file in Explorer exactly as I want, but I need a way to implement this in my WPF app.
Explorer Command Line Arguments
http://support.microsoft.com/kb/152457
Explorer [/n] [/e] [(,)/root,<object>] [/select,<object>]
/n Opens a new single-pane window for the default
selection. This is usually the root of the drive Windows
is installed on. If the window is already open, a
duplicate opens.
/e Opens Windows Explorer in its default view.
/root,<object> Opens a window view of the specified object.
/select,<object> Opens a window view with the specified folder, file or
application selected.
You will also want to put quotes around the filename like so:
startInfo.FileName = "explorer.exe";
startInfo.Arguments = "/select,\"" + ConfigFile.File.FullName + "\"";

Resources