コード例 #1
0
ファイル: Process.cs プロジェクト: JeffreyZksun/gpstranslator
		/// <summary>
		/// Starts the process resource that is specified by the parameter containing process start information (for example, the file name of the process to start) and associates the resource with a new OpenNETCF.Diagnostics.Process component.
		/// </summary>
		/// <param name="startInfo">The OpenNETCF.Diagnostics.ProcessStartInfo that contains the information that is used to start the process, including the file name and any command line arguments.</param>
		/// <returns>A new OpenNETCF.Diagnostics.Process component that is associated with the process resource, or null if no process resource is started (for example, if an existing process is reused).</returns>
		public static Process Start(ProcessStartInfo startInfo)
		{
			Process newprocess = new Process();
			newprocess.m_pstart = startInfo;
			newprocess.Start();

			return newprocess;
		}
コード例 #2
0
ファイル: Process.cs プロジェクト: JeffreyZksun/gpstranslator
		/// <summary>
		/// Gets a new <see cref="Process"/> component and associates it with the currently active process.
		/// <para><b>Revised in v1.3</b></para>
		/// </summary>
		/// <returns>A new <see cref="Process"/> component associated with the process resource that is running the calling application.</returns>
		public static Process GetCurrentProcess()
		{
			IntPtr pBase = new IntPtr((int) (GetPUserKData() + SYSHANDLE_OFFSET));
			 
			Process p = new Process();
			//set the id and handle
			p.m_pinfo.hProcess = new IntPtr(SH_CURPROC + SYS_HANDLE_BASE);
			p.m_pinfo.dwProcessID = Marshal.ReadInt32(pBase, SH_CURPROC * 4);

			return p;
		}
コード例 #3
0
ファイル: Process.cs プロジェクト: JeffreyZksun/gpstranslator
		/// <summary>
		/// Returns a new <see cref="Process"/> component, given the identifier of a process on the device.
		/// <para><b>New in v1.1</b></para>
		/// </summary>
		/// <param name="processId">The system-unique identifier of a process resource.</param>
		/// <returns>A <see cref="Process"/> component that is associated with the local process resource identified by the processId parameter.</returns>
		public static Process GetProcessById(int processId)
		{
			//create new process
			Process newprocess = new Process();

			//assign process id
			newprocess.m_pinfo.dwProcessID = processId;

			//open handle
			newprocess.m_pinfo.hProcess = OpenProcess(0, false, processId);
			
			//return process instance
			return newprocess;
		}