UlteriusServer.Api.Win32.Desktop.CreateProcess C# (CSharp) Method

CreateProcess() public method

Creates a new process in a desktop.
public CreateProcess ( string path ) : Process
path string Path to application.
return System.Diagnostics.Process
        public Process CreateProcess(string path)
        {
            // make sure object isnt disposed.
            CheckDisposed();

            // make sure a desktop is open.
            if (!IsOpen) return null;

            // set startup parameters.
            var si = new STARTUPINFO();
            si.cb = Marshal.SizeOf(si);
            si.lpDesktop = DesktopName;

            var pi = new PROCESS_INFORMATION();

            // start the process.
            var result = CreateProcess(null, path, IntPtr.Zero, IntPtr.Zero, true, NORMAL_PRIORITY_CLASS, IntPtr.Zero,
                null, ref si, ref pi);

            // error?
            if (!result) return null;

            // Get the process.
            return Process.GetProcessById(pi.dwProcessId);
        }

Same methods

Desktop::CreateProcess ( string path, string desktop ) : Process
Desktop::CreateProcess ( string lpApplicationName, string lpCommandLine, IntPtr lpProcessAttributes, IntPtr lpThreadAttributes, bool bInheritHandles, int dwCreationFlags, IntPtr lpEnvironment, string lpCurrentDirectory, STARTUPINFO &lpStartupInfo, PROCESS_INFORMATION &lpProcessInformation ) : bool