在WinCE下使用C#来打开一个外部程序

以打开一个IE为例,介绍如何在WinCE下使用C#来打开一个外部文件:

 

using System.Runtime.InteropServices;
 
[DllImport("coredll.Dll",  EntryPoint="CreateProcess",  SetLastError=true)] 
extern static int CreateProcess(string strImageName, string strCmdLine, IntPtr pProcessAttributes,   
                            IntPtr pThreadAttributes, int bInheritsHandle, int dwCreationFlags, 
                            IntPtr pEnvironment, IntPtr pCurrentDir, IntPtr  bArray, ProcessInfo oProc); 

public  class  ProcessInfo 
{ 
   public  Int32  hProcess; 
   public  Int32  hThread; 
   public  Int32  ProcessID; 
   public  Int32  ThreadID; 
} 

private void button_Click(object sender, System.EventArgs e) 
{ 
    ProcessInfo  pi  =  new  ProcessInfo(); 
    CreateProcess("\\windows\\iesample.exe", 
                     "\\HardDisk\\Readme.htm", IntPtr.Zero, 
                   IntPtr.Zero, 0, 0, IntPtr.Zero,  IntPtr.Zero,  IntPtr.Zero,  pi);   
} 

转载于:https://www.cnblogs.com/mugua/archive/2009/03/16/1413814.html

你可能感兴趣的:(在WinCE下使用C#来打开一个外部程序)