Exemple #1
0
        /// <summary>
        /// Starts (or reuses) the process resource that is specified by the OpenNETCF.Diagnostics.Process.StartInfo property of this OpenNETCF.Diagnostics.Process component and associates it with the component.
        /// </summary>
        /// <returns><b>true</b> if a process resource is started; <b>false</b> if no new process resource is started (for example, if an existing process is reused).</returns>
        public bool Start()
        {
            if (m_pstart.UseShellExecute)
            {
                //create a shellexecute structure
                ShellExecuteInfo sei = new ShellExecuteInfo();

                //pin strings
                GCHandle hfile = GCHandle.Alloc((m_pstart.FileName + '\0').ToCharArray(), GCHandleType.Pinned);
                sei.lpFile = (IntPtr)((int)hfile.AddrOfPinnedObject() + 4);

                //windowstyle
                sei.nShow = (int)m_pstart.WindowStyle;

                //pin arguments
                GCHandle hargs = new GCHandle();
                if (m_pstart.Arguments != null)
                {
                    hargs            = GCHandle.Alloc((m_pstart.Arguments + '\0').ToCharArray(), GCHandleType.Pinned);
                    sei.lpParameters = (IntPtr)((int)hargs.AddrOfPinnedObject() + 4);
                }

                //pin verb
                GCHandle hverb = new GCHandle();
                if (m_pstart.Verb != null)
                {
                    hverb      = GCHandle.Alloc(m_pstart.Verb.ToCharArray(), GCHandleType.Pinned);
                    sei.lpVerb = (IntPtr)((int)hverb.AddrOfPinnedObject() + 4);
                }

                //call api function
                bool result = ShellExecuteEx(sei);

                //store the process handle
                this.m_pinfo.hProcess    = sei.hProcess;
                this.m_pinfo.dwProcessID = sei.hProcess.ToInt32();


                //free pinned handles
                if (hfile.IsAllocated)
                {
                    hfile.Free();
                }
                if (hargs.IsAllocated)
                {
                    hargs.Free();
                }
                if (hverb.IsAllocated)
                {
                    hverb.Free();
                }

                //return status
                return(result);
            }
            else
            {
                return(CreateProcess(m_pstart.FileName, m_pstart.Arguments, IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, m_pinfo));
            }
        }
Exemple #2
0
        /// <summary>
        /// Opens properties windows for specified path.
        /// </summary>
        public static bool ShowFileProperties(string fileName)
        {
            var info = ShellExecuteInfo.Initialize();

            info.Verb      = "properties";
            info.File      = fileName;
            info.ShowFlags = ShellSw.ShowDefault;
            info.SeeMask   = ShellSeeMask.InvokeIdList;
            return(ShellExecuteEx(ref info));
        }
Exemple #3
0
 /// <summary>
 /// 
 /// Author :: Vivek.T
 /// Email:: [email protected]
 /// url : http://www.codeproject.com/KB/shell/openwith.aspx
 /// </summary>
 /// <param name="file"></param>
 static void OpenAs(string file)
 {
     ShellExecuteInfo sei = new ShellExecuteInfo();
     sei.Size = Marshal.SizeOf(sei);
     sei.Verb = "openas";
     sei.File = file;
     sei.Show = SW_NORMAL;
     if (!ShellExecuteEx(ref sei))
         throw new System.ComponentModel.Win32Exception();
 }
Exemple #4
0
 public static bool ShowDialog( Icon windowIcon, string file )
 {
     ShellExecuteInfo sei = new ShellExecuteInfo ( );
       sei.Size = Marshal.SizeOf ( sei );
       sei.Verb = VERB_OPENAS;
       sei.Icon = windowIcon.Handle;
       sei.Mask = SEE_MASK_NOCLOSEPROCESS;
       sei.File = file;
       sei.Show = SW_NORMAL;
       return ShellExecuteEx ( ref sei );
 }
        public static bool ShowProperties(string filename)
        {
            var info = new ShellExecuteInfo();

            info.cbSize = Marshal.SizeOf(info);
            info.lpVerb = "properties";
            info.lpFile = filename;
            info.nShow  = SwShow;
            info.fMask  = SeeMaskInvokeidlist;
            return(ShellExecuteEx(ref info));
        }
Exemple #6
0
        public static void ShowFileProperties(string filePath, IntPtr ownerHwnd)
        {
            ShellExecuteInfo sei = new ShellExecuteInfo();

            sei.cbSize = Marshal.SizeOf(sei);
            sei.fMask  = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_INVOKEIDLIST | SEE_MASK_FLAG_NO_UI;
            sei.hWnd   = ownerHwnd.ToInt32();
            sei.lpVerb = "properties";
            sei.lpFile = filePath;
            ShellExecuteExA(ref sei);
        }
Exemple #7
0
        /// <summary>
        /// Show the properties dialog of a file
        /// </summary>
        /// <param name="path">The path of the file</param>
        internal static void ShowFileProperties(string path)
        {
            ShellExecuteInfo info = new ShellExecuteInfo();

            info.cbSize = Marshal.SizeOf(info);
            info.lpVerb = "properties";
            info.lpFile = path;
            info.nShow  = 5;
            info.fMask  = 12;
            ShellExecuteEx(ref info);
        }
Exemple #8
0
        public static bool ShowDialog(Icon windowIcon, string file)
        {
            ShellExecuteInfo sei = new ShellExecuteInfo( );

            sei.Size = Marshal.SizeOf(sei);
            sei.Verb = VERB_OPENAS;
            sei.Icon = windowIcon.Handle;
            sei.Mask = SEE_MASK_NOCLOSEPROCESS;
            sei.File = file;
            sei.Show = SW_NORMAL;
            return(ShellExecuteEx(ref sei));
        }
Exemple #9
0
    public static bool ShowFileProperties(string filename)
    {
        var info = new ShellExecuteInfo();

        info.cbSize = Marshal.SizeOf(info);
        info.lpVerb = "properties";
        info.lpFile = filename;
        //info.lpParameters = "Security";
        info.nShow = (int)ShowWindowCommands.Show;
        info.fMask = (uint)ShellExecuteMasks.InvokeIdList;
        return(Shell32.ShellExecuteEx(ref info));
    }
        /// <summary>Opens the properties window of the file.</summary>
        /// <param name="filePath">The path of the file to view the properties of.</param>
        public bool OpenProperties(string filePath)
        {
            ShellExecuteInfo info = new ShellExecuteInfo {
                cbSize = ShellExecuteInfo.CBSize,
                lpVerb = "properties",
                lpFile = filePath,
                nShow  = ShowCommands.Show,
                fMask  = ShellExecuteMaskFlags.InvokeIDList,
            };

            return(ShellExecuteEx(ref info));
        }
Exemple #11
0
        /////////////////////////////////////////////
        // Properties

        public static void ShowProperties(string fileName)
        {
            ShellExecuteInfo info = new ShellExecuteInfo();

            info.cbSize = Marshal.SizeOf(info);
            info.lpFile = fileName;
            info.nShow  = (int)ShowWindowType.Show;
            info.fMask  = 0xC;             // SeeMaskInvokeIdList = 0xc
            info.lpVerb = "properties";

            ShellExecuteEx(ref info);
        }
Exemple #12
0
        public static void ShowProperties(string fileName)
        {
            var info = new ShellExecuteInfo();

            info.cbSize = Marshal.SizeOf(info);
            info.lpFile = fileName;
            info.nShow  = ShowWindowType.Show;
            info.fMask  = Win32.SeeMaskInvokeIdList;
            info.lpVerb = "properties";

            Win32.ShellExecuteEx(ref info);
        }
Exemple #13
0
        public static void OpenWith(string file)
        {
            ShellExecuteInfo sei = new ShellExecuteInfo();

            sei.Size = Marshal.SizeOf(sei);
            sei.Verb = "openas";
            sei.File = file;
            sei.Show = SW_NORMAL;
            if (!ShellExecuteEx(ref sei))
            {
                throw new System.ComponentModel.Win32Exception();
            }
        }
Exemple #14
0
        public static void ShowProperties(string fileName)
        {
            ShellExecuteInfo info = new ShellExecuteInfo
            {
                cbSize = ShellExecuteInfo.SizeOf,
                lpFile = fileName,
                nShow  = ShowWindowType.Show,
                fMask  = Win32.SeeMaskInvokeIdList,
                lpVerb = "properties"
            };

            Win32.ShellExecuteEx(ref info);
        }
Exemple #15
0
        private static void OpenAsOld(IntPtr hwndParent, string file)
        {
            ShellExecuteInfo sei = new ShellExecuteInfo();

            sei.Size = Marshal.SizeOf(sei);
            sei.Verb = "openas";
            sei.File = file;
            sei.Show = SW_NORMAL;
            sei.hwnd = hwndParent;
            if (!ShellExecuteEx(ref sei))
            {
                throw new System.ComponentModel.Win32Exception();
            }
        }
Exemple #16
0
        private static void OpenAsOld(IntPtr hwndParent, string file)
        {
            ShellExecuteInfo sei = new ShellExecuteInfo();

            sei.Size = Marshal.SizeOf(sei);
            sei.Verb = "openas";
            sei.File = file;
            sei.Show = SW_NORMAL;
            sei.hwnd = hwndParent;
            sei.Mask = 12; //(fmask = SEE_MASK_INVOKEIDLIST) This might fix windows 10 support in some edge case, idk
            if (!ShellExecuteEx(ref sei))
            {
                throw new System.ComponentModel.Win32Exception();
            }
        }
 public static void ShowProperties(IntPtr hwnd, string FileName)
 {
     try
     {
         ShellExecuteInfo SEI = new ShellExecuteInfo();
         SEI.Mask = SEE_MASK_NOCLOSEPROCESS + SEE_MASK_INVOKEIDLIST + SEE_MASK_FLAG_NO_UI;
         SEI.hwnd = hwnd;
         SEI.Verb = "properties";
         SEI.File = FileName;
         SEI.Show = 1;
         SEI.Size = System.Runtime.InteropServices.Marshal.SizeOf(SEI);
         bool r = ShellExecuteEx(ref SEI);
     }
     catch
     {
     }
 }
        public static void ShowProperties(IntPtr hwnd, string FileName)
        {
            try
            {
                ShellExecuteInfo SEI = new ShellExecuteInfo();
                SEI.Mask = SEE_MASK_NOCLOSEPROCESS + SEE_MASK_INVOKEIDLIST + SEE_MASK_FLAG_NO_UI;
                SEI.hwnd = hwnd;
                SEI.Verb = "properties";
                SEI.File = FileName;
                SEI.Show = 1;
                SEI.Size = System.Runtime.InteropServices.Marshal.SizeOf(SEI);
                bool r = ShellExecuteEx(ref SEI);
            }
            catch
            {

            }
        }
Exemple #19
0
        internal static bool ShowOpenWith(string filePath)
        {
            ShellExecuteInfo info = new ShellExecuteInfo();

            info = new ShellExecuteInfo {
                Size = Marshal.SizeOf(info),
                Verb = "openas",
                File = filePath,
                Show = 1
            };
            try
            {
                return(ShellExecuteEx(ref info));
            }
            catch
            {
                return(false);
            }
        }
Exemple #20
0
        internal static bool ShowProperties(string filePath)
        {
            ShellExecuteInfo info = new ShellExecuteInfo();

            info = new ShellExecuteInfo {
                Size = Marshal.SizeOf(info),
                Verb = "properties",
                File = filePath,
                Show = 5,
                Mask = 12
            };
            try
            {
                return(ShellExecuteEx(ref info));
            }
            catch
            {
                return(false);
            }
        }
Exemple #21
0
        /// <summary>
        /// Open the file with the corresponding Application.
        /// </summary>
        /// <param name="file">The file.</param>
        public static void OpenAs(string file)
        {
            /*8ShellExecuteInfo sei = new ShellExecuteInfo();
             * sei.Size = Marshal.SizeOf(sei);
             * sei.Verb = "openas";
             * sei.File = file;
             * sei.Show = Normal;
             *
             * if (!ShellExecuteEx(ref sei))
             * {
             *  throw new System.ComponentModel.Win32Exception();
             * }*/

            ShellExecuteInfo sei = new ShellExecuteInfo();

            sei.Size = Marshal.SizeOf(sei);
            sei.Verb = "openas";
            sei.File = file;
            sei.Show = Normal;
            if (!ShellExecuteEx(ref sei))
            {
                throw new System.ComponentModel.Win32Exception();
            }
        }
 public static void ShellOpen(this String file)
 {
     var info = new ShellExecuteInfo();
     info.Size = Marshal.SizeOf(info);
     info.File = file;
     info.Show = SW_NORMAL;
     if (!ShellExecuteEx(ref info))
     {
         Int32 error = Marshal.GetLastWin32Error();
         if (error != WIN32_ERROR_CANCELLED)
         {
             throw Marshal.GetExceptionForHR(error);
         }
     }
 }
Exemple #23
0
		/// <summary>
		/// Starts (or reuses) the process resource that is specified by the OpenNETCF.Diagnostics.Process.StartInfo property of this OpenNETCF.Diagnostics.Process component and associates it with the component.
		/// </summary>
		/// <returns><b>true</b> if a process resource is started; <b>false</b> if no new process resource is started (for example, if an existing process is reused).</returns>
		public bool Start()
		{
			if(m_pstart.UseShellExecute)
			{
				//create a shellexecute structure
				ShellExecuteInfo sei = new ShellExecuteInfo();
				
				//pin strings
				GCHandle hfile = GCHandle.Alloc((m_pstart.FileName + '\0').ToCharArray(), GCHandleType.Pinned);
				sei.lpFile = (IntPtr)((int)hfile.AddrOfPinnedObject() + 4);

				//windowstyle
				sei.nShow = (int)m_pstart.WindowStyle;

				//pin arguments
				GCHandle hargs = new GCHandle();
				if(m_pstart.Arguments!=null)
				{
					hargs = GCHandle.Alloc((m_pstart.Arguments + '\0').ToCharArray(), GCHandleType.Pinned);
					sei.lpParameters = (IntPtr)((int)hargs.AddrOfPinnedObject() + 4);
				}

				//pin verb
				GCHandle hverb = new GCHandle();
				if(m_pstart.Verb!=null)
				{
					hverb = GCHandle.Alloc(m_pstart.Verb.ToCharArray(), GCHandleType.Pinned);
					sei.lpVerb = (IntPtr)((int)hverb.AddrOfPinnedObject() + 4);
				}

				//call api function
				bool result = ShellExecuteEx(sei);

				//store the process handle
				this.m_pinfo.hProcess = sei.hProcess;
				this.m_pinfo.dwProcessID = sei.hProcess.ToInt32();
				
				
				//free pinned handles
				if(hfile.IsAllocated)
				{
					hfile.Free();
				}
				if(hargs.IsAllocated)
				{
					hargs.Free();
				}
				if(hverb.IsAllocated)
				{
					hverb.Free();
				}

				//return status
				return result;
			}
			else
			{
				return CreateProcess(m_pstart.FileName, m_pstart.Arguments, IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, m_pinfo);
			}
		}
Exemple #24
0
 internal static extern bool ShellExecuteEx(ref ShellExecuteInfo lpExecInfo);
Exemple #25
0
		private extern static bool ShellExecuteEx( ShellExecuteInfo ex );
 public static extern bool ShellExecuteEx(ref ShellExecuteInfo executeInfo);
 public static extern bool ShellExecuteEx(ref ShellExecuteInfo lpExecInfo);
 extern public static bool ShellExecuteEx(ref ShellExecuteInfo lpExecInfo);
Exemple #29
0
 private static extern bool ShellExecuteEx( ref ShellExecuteInfo lpExecInfo );
        public virtual void ExploreMenuItem_Click(object sender, EventArgs e)
        {
            if (Verb.Equals(ConsoleVerb))
            {
                ConsoleForm cf = new ConsoleForm();
                cf.ShowDialog();
            }
            else
            if (Verb.Equals(PreferencesVerb))
            {
                ContextMenuEventArgs c = (ContextMenuEventArgs)e;

                //NativeWindow nativeWindow = new NativeWindow();
                //nativeWindow.AssignHandle(c.CommandInfo.hwnd);

                PreferencesForm pf = new PreferencesForm();
                pf.ShowDialog();
            }
            else if (Verb.Equals(ConnectVerb))
            {
                DeviseAddr addr = new DeviseAddr();
                if (!string.IsNullOrEmpty(addr.ConnectionType) && addr.ConnectionType.Equals("usb") &&
                    !string.IsNullOrEmpty(addr.UsbDevice))
                {
                    //ADBCommand commandD = new ADBCommand();
                    //CommandResult retD = commandD.Disconnect(true);
                }
                else
                {
                    ADBCommand    commandD = new ADBCommand();
                    CommandResult retD     = commandD.Disconnect();
                }

                ADBCommand    command = new ADBCommand();
                CommandResult ret     = command.Connect();
                ret.ShowMessage();
                ADBCommand    commandDev = new ADBCommand();
                CommandResult retDev     = commandDev.Devices();
                if (retDev.IsSuccess)
                {
                    Dictionary <string, string> dicDev = new Dictionary <string, string>();
                    foreach (var str in retDev.Message.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        if (!string.IsNullOrEmpty(str))
                        {
                            string[] s = str.Split(' ');
                            if (s.Any())
                            {
                                string sDevType = string.Empty;
                                if (s.Length > 1)
                                {
                                    sDevType = s[1];
                                }
                                if (!dicDev.ContainsKey(s[0]))
                                {
                                    dicDev.Add(s[0], sDevType);
                                }
                            }
                        }
                    }

                    if (dicDev.Count == 0)
                    {
                        MessageBox.Show("List of devices attached - is empty",
                                        "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    if (!dicDev.ContainsKey(commandDev.CurrentDevice()))
                    {
                        MessageBox.Show("List of devices attached - does not contain selected device",
                                        "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    if (dicDev.ContainsKey(commandDev.CurrentDevice()) && dicDev[commandDev.CurrentDevice()].Equals("unauthorized"))
                    {
                        MessageBox.Show("Please authorize this computer on dialog in device,\r\nAnd after that, click Ok button to continue",
                                        "Warning! " + retDev.Message.Replace("\t", " - "), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    IntPtr pParrent = ItemIdList.Create(null, _folderObj.PathData).Ptr;
                    Shell32.SHChangeNotify(ShellChangeEvents.UpdateDir,
                                           ShellChangeFlags.IdList | ShellChangeFlags.Flush,
                                           pParrent,
                                           IntPtr.Zero);
                    Marshal.FreeCoTaskMem(pParrent);
                }
            }
            else if (Verb.Equals(DisconnectVerb))
            {
                ADBCommand    command = new ADBCommand();
                CommandResult ret     = command.Disconnect();
                ret.ShowMessage();

                IntPtr pParrent = ItemIdList.Create(null, _folderObj.PathData).Ptr;
                Shell32.SHChangeNotify(ShellChangeEvents.UpdateDir,
                                       ShellChangeFlags.IdList | ShellChangeFlags.Flush,
                                       pParrent,
                                       IntPtr.Zero);
                Marshal.FreeCoTaskMem(pParrent);
            }
            else if (Verb.Equals(InstallApkVerb))
            {
                ADBCommand    command = new ADBCommand();
                CommandResult ret     = command.Install(_folderObj.PathString);
                ret.ShowMessage();
            }
            else if (Verb.Equals(CreateScreenshotVerb))
            {
                ADBCommand    command = new ADBCommand();
                CommandResult ret     = command.CreateScreenShot(_folderObj.PathString);
                ret.ShowMessage();
                // MessageBox.Show("Create Screenshot to: " + _folderObj.PathString);
            }
            else if (Verb.Equals(InfoVerb))
            {
                StringCollection sc = new StringCollection();

                PermissionsForm pf = new PermissionsForm();
                pf.SetData(_items, _folderObj);
                pf.ShowDialog();

                /*
                 * if (_folderObj.GetParrent() != null)
                 * {
                 *  _folderObj.GetParrent().RefreshItems(_items);
                 * }
                 */
                //_folderObj.RefreshItems(_items);
            }
            else if (Verb.Equals(NewFolderVerb))
            {
                _folderObj.NewFolder();
            }
            else if (Verb.Equals(RenameVerb))
            {
                using (Malloc m = Shell32.GetMalloc())
                {
                    byte[][]      clone = (byte[][])fqPidl.Clone();
                    List <byte[]> lsn   = clone.ToList();
                    lsn.RemoveAt(lsn.Count - 1);
                    clone = lsn.ToArray();
                    ItemIdList itemIdList       = ItemIdList.Create(m, fqPidl);
                    ItemIdList itemIdListFolder = ItemIdList.Create(m, clone);
                    Shell32.SHOpenFolderAndSelectItems(itemIdListFolder.Ptr, 1, new[] { itemIdList.Ptr }, Shell32.OFASI_EDIT);
                }
            }
            else if (Verb.Equals(CopyVerb))
            {
                DataObject       dobj      = new DataObject();
                List <string>    file_list = new List <string>();
                StringCollection sc        = new StringCollection();
                foreach (IFolderObject folderObject in _items)
                {
                    string sAdd = ((folderObject.Attributes & FolderAttributes.Folder) == FolderAttributes.Folder)
                            ? "[virtualfolder]"
                            : "[virtualfile]";
                    file_list.Add(string.Format("{0}{1}\\{2}", sAdd, CodePath.Code(folderObject.PathData), folderObject.PathString));
                    sc.Add(string.Format("{0}{1}\\{2}", sAdd, CodePath.Code(folderObject.PathData), folderObject.PathString));
                    //sc.Add(folderObject.PathString);
                    //file_list.Add(string.Format("{0}\\{1}", sAdd, folderObject.PathString));
                }
                dobj.SetData(DataFormats.FileDrop, (System.String[])file_list.ToArray());
                dobj.SetData(typeof(StringCollection), sc);
                Clipboard.SetDataObject(dobj, false);
                //Clipboard.SetFileDropList(sc);
            }
            else if (Verb.Equals(PasteLinkVerb))
            {
                List <string> lFiles = new List <string>();
                if (_folderObj.DataObject != null)
                {
                    DataObject       dobj = _folderObj.DataObject;
                    StringCollection z    = (StringCollection)dobj.GetData(typeof(StringCollection));
                    foreach (string s in z)
                    {
                        if (s.StartsWith("[virtualfolder]") || s.StartsWith("[virtualfile]"))
                        {
                            lFiles.Add(s);
                        }
                    }

                    lFiles.Add(_folderObj.PathString);
                    _folderObj.CopyItems(null, lFiles);

                    _folderObj.DataObject = null;
                }
                else
                if (Clipboard.ContainsData("DataObject"))
                {
                    DataObject       dobj = (DataObject)Clipboard.GetDataObject();
                    StringCollection z    = (StringCollection)dobj.GetData(typeof(StringCollection));
                    if (z != null)
                    {
                        foreach (string s in z)
                        {
                            if (s.StartsWith("[virtualfolder]"))
                            {
                                lFiles.Add(s);
                            }
                        }

                        lFiles.Add(_folderObj.PathString);
                        _folderObj.CopyItems(null, lFiles);
                    }
                }
            }
            else if (Verb.Equals(PasteVerb))
            {
                List <string> lFiles = new List <string>();
                //only for external
                if (Clipboard.ContainsFileDropList())
                {
                    StringCollection files = Clipboard.GetFileDropList();
                    foreach (string file in files)
                    {
                        if (!file.StartsWith("[virtualfolder]") && !file.StartsWith("[virtualfile]"))
                        {
                            lFiles.Add(file);
                        }
                    }
                }

                if (_folderObj.DataObject != null)
                {
                    DataObject       dobj = _folderObj.DataObject;
                    StringCollection z    = (StringCollection)dobj.GetData(typeof(StringCollection));
                    foreach (string s in z)
                    {
                        lFiles.Add(s);
                    }
                    _folderObj.DataObject = null;
                }
                else
                if (Clipboard.ContainsData("DataObject"))
                {
                    DataObject       dobj = (DataObject)Clipboard.GetDataObject();
                    StringCollection z    = (StringCollection)dobj.GetData(typeof(StringCollection));
                    if (z != null)
                    {
                        foreach (string s in z)
                        {
                            lFiles.Add(s);
                        }
                        //lFiles = DataObjectHelper.GetFiles(dobj);
                    }
                }

                string sr = string.Empty;
                foreach (string file in lFiles)
                {
                    sr += file + "\r\n";
                }
                sr += "to\r\n" + _folderObj.PathString;
                //MessageBox.Show(sr);
                Debug.WriteLine(sr);
                _folderObj.CopyItems(_folderObj, lFiles);
            }
            else if (Verb.Equals(DeleteVerb))
            {
                _folderObj.DeleteItems(_items);
            }
            else
            {
                using (Malloc m = Shell32.GetMalloc())
                {
                    ContextMenuEventArgs c = (ContextMenuEventArgs)e;

                    ShellExecuteInfo sei = new ShellExecuteInfo();
                    sei.cbSize = (uint)Marshal.SizeOf(typeof(ShellExecuteInfo));
                    sei.fMask  = ShellExecuteOptions.IdList | ShellExecuteOptions.ClassName;
                    ItemIdList itemIdList = ItemIdList.Create(m, fqPidl);
                    sei.lpIDList = itemIdList.Ptr;
                    sei.lpClass  = "folder";
                    sei.hwnd     = c.CommandInfo.hwnd;
                    sei.nShow    = c.CommandInfo.nShow;
                    sei.lpVerb   = Verb;

                    int result = Shell32.ShellExecuteEx(ref sei);

                    //m.Free(itemIdList.Ptr);

                    if (result == 0)
                    {
                        int lastError = Marshal.GetLastWin32Error();
                        throw new Exception("ShellExecuteEx failed; last error = " + lastError);
                    }
                }
            }
        }
Exemple #31
0
 public static extern bool ShellExecuteEx(ShellExecuteInfo info);
 private static extern Boolean ShellExecuteEx(ref ShellExecuteInfo lpExecInfo);
Exemple #33
0
 private extern static bool ShellExecuteEx(ShellExecuteInfo ex);
Exemple #34
0
 extern private static bool ShellExecuteEx(ref ShellExecuteInfo lpExecInfo);
Exemple #35
0
 private static extern bool ShellExecuteExA(ref ShellExecuteInfo lpExecInfo);