<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 在C#中調用WINCE連接PC的程序

在C#中調用WINCE連接PC的程序

——
作者: 時(shí)間:2006-03-24 來(lái)源: 收藏
由于在某些PDA上的操作系統不像PPC那樣直接插上USB就可以連接上PC,必須手動(dòng)選擇菜單上的連接程序才可以連接,而在特殊情況下必須由用戶(hù)控制連接,在此提供代碼:
1、加入命名空間:
using System.Runtime.InteropServices;
using System.Reflection;
2、聲明API和類(lèi)
[DllImport("CoreDll.dll", SetLastError=true)]
  private extern static
   int CreateProcess( String imageName,
   String cmdLine,
   IntPtr lpProcessAttributes,
   IntPtr lpThreadAttributes,
   Int32 boolInheritHandles,
   Int32 dwCreationFlags,
   IntPtr lpEnvironment,
   IntPtr lpszCurrentDir,
   byte [] si,
   ProcessInfo pi );

public class ProcessInfo
  {
   public IntPtr hProcess;
   public IntPtr hThread;
   public Int32 ProcessId;
   public Int32 ThreadId;
  }
3、創(chuàng )建調用函數
public static bool CreateProcess( String ExeName, String CmdLine, ProcessInfo pi )
  {
   //Int32 INFINITE;
   //unchecked {INFINITE = (int)0xFFFFFFFF;}
     
   if ( pi == null )
    pi = new ProcessInfo();
   byte [] si = new byte[128];
   CreateProcess(ExeName, CmdLine, IntPtr.Zero, IntPtr.Zero,
    0, 0, IntPtr.Zero, IntPtr.Zero, si, pi);
   //WaitForSingleObject(pi.hProcess,INFINITE);
   return true;
  }

4、調用連接程序
private void menuItem9_Click(object sender, System.EventArgs e)
 {
  string progPath = "\WINDOWS\REPLLOG.EXE";     //在設備和桌面計算機之間建立ActiveSync 連接
  //string progPath = @"Windowsobrread.exe";//這個(gè)程序我忘了是調用什么的,好像是CASIO IT500機上什么的:)
     
  ProcessInfo pi=new ProcessInfo();
   CreateProcess(progPath, "", pi);
  //   if ( CreateProcess(progPath, "", pi) )
   //    MessageBox.Show("Success! PID = " + pi.ProcessId.ToString());
  //   else
  //    MessageBox.Show("Failed! System Error = " + GetLastError().ToString());
 //   MessageBox.Show("Done Waiting");
 } 

pid控制相關(guān)文章:pid控制原理




關(guān)鍵詞: WINCE

評論


相關(guān)推薦

技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>