Esempio n. 1
0
        private bool GetExplorerSelectedItemPath(IntPtr hwnd, ref string selectedItem)
        {
            try
            {
                string[] items = explorer.GetSelectedItems(hwnd);

                if (items == null || items.Length == 0)
                {
                    this.ErrorMessage = "Nothing to preview";
                    return(false);
                }

                // TODO multiselect
                selectedItem = items.First();
                return(true);
            }
            catch (Exception ex)
            {
                this.ErrorMessage = "Failed to access explorer with error:\n" + ex.ToString();
                return(false);
            }
        }