public static void EditFile(string file) { ShellExecute shellExecute = new ShellExecute(); shellExecute.Verb = ShellExecute.EditFile; shellExecute.Path = file; shellExecute.Execute(); }
public static void Open(string path) { var execute = new ShellExecute { Verb = ShellExecute.OpenFile, Path = path }; execute.Execute(); }
/// <summary> /// A double click occured´in the list view /// If an item was selected, open it with the default program /// </summary> /// <param name = "sender"></param> /// <param name = "e"></param> private void listViewNonMusicFiles_DoubleClick(object sender, EventArgs e) { ListViewHitTestInfo hitInfo = listViewNonMusicFiles.HitTest(listViewNonMusicFiles.PointToClient(MousePosition)); if (listViewNonMusicFiles.SelectedItems.Count > 0) { ListViewItem item = listViewNonMusicFiles.SelectedItems[0]; if (item == hitInfo.Item) { ShellExecute shell = new ShellExecute(); shell.Path = (string)item.Tag; shell.Execute(); } } }
public static void ExploreFolder(string directory, IntPtr handle) { ShellExecute shellExecute = new ShellExecute(); shellExecute.Verb = ShellExecute.ExploreFolder; shellExecute.Path = directory; shellExecute.OwnerHandle = handle; shellExecute.Execute(); }
public static void ShowFile(string file) { ShellExecute shellExecute = new ShellExecute(); shellExecute.Path = file; shellExecute.Execute(); }