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);
}