2014-03-19 100 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

相關問題