2014-03-19 109 views
0

我试图将我的手机设备víaUSB连接到服务器以传输数据。找不到PInvoke DLL kernel32.dll文件C#

我正在与RAPI,这是我的代码;

using System; 
using System.Linq; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Text; 
using System.Windows.Forms; 
using System.Data.SqlServerCe; 
using OpenNETCF.Desktop.Communication; 

我按照下面的步骤添加OpenNETCF.Desktop.Communication

  1. 在解决方案资源管理器窗口中,右键单击引用文件夹。 显示一个弹出式菜单。
  2. 从菜单中选择添加引用。
  3. 显示添加引用对话框。选择OpenNETCF.Desktop.Communication组件。
  4. 单击确定按钮将选定的组件添加到您的项目中。

这是我的代码:

 private void BTN_LEVANTAMIENTO_Click(object sender, EventArgs e) 
    { 
      try 
      { 
       RAPI myrapi = new RAPI(); //Is it Okay? 
       myrapi.Connect(); 
       while (!myrapi.DevicePresent) 
       { 
        MessageBox.Show("Please connect your device to your PC using ActiveSync and before clicking the OK button.", 
         "No Device Present"); 
        //myrapi.Connect(); 
       } 
      } 

      catch (Exception ex) 
      { 
       MessageBox.Show("The following error occurred while attempting to connect to" + " your device - " + ex.Message, 
        "Connection Error"); 
       Application.Exit(); 
      } 

它显示我是

"No se puede encontrar el archivo DLL PInvoke kernel32.dll c#" 

约我还能有什么任何想法的问题?

回答

2

您应该使用RAPI2代替。 RAPI2代替RAPI。

+0

别担心......我会试试@Brett Nemec – PETTA

+0

Thanks @Robert H – bnem

相关问题