static void Main(string[] args) { IntPtr handle = GetForegroundWindow(); List <string> selected = new List <string>(); Shell32.Shell shell = new Shell32.Shell(); foreach (var window in shell.Windows()) { var testy = window.HWND; var testy2 = (int)handle; if (window.HWND == (int)handle) { Shell32.FolderItems items = ((Shell32.IShellFolderViewDual2)window.Document).SelectedItems(); foreach (Shell32.FolderItem item in items) { if (args[0] == "browse") { if (item.Path[1] == ':') { String s = String.Format("/select,\"{0}\"", item.Path); shell.ShellExecute("explorer.exe", s); } else { shell.Explore(Path.GetDirectoryName(item.Path)); } } if (args[0] == "open") { shell.ShellExecute(args[1], item.Path); } } } } }
private void RtNotes_LinkClicked(object sender, LinkClickedEventArgs e) { var path = e.LinkText; Guid guid; if (ParseMlrLink(path, out guid)) { CurrentNode = contr.NodeByGuid(guid) ?? CurrentNode; return; } ParseMloLink(ref path); Shell32.Shell shell = new Shell32.Shell(); shell.ShellExecute(path); }