无法找到PInvoke DLL kernel32.dll文件c#

本文关键字:kernel32 dll 文件 DLL PInvoke | 更新日期: 2023-09-27 17:51:02

我正在尝试将我的手机设备vía USB连接到服务器以传输数据。

我正在使用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. 在解决方案资源管理器窗口中,右键单击References文件夹。弹出菜单。
  2. 在菜单中选择"Add Reference"。
  3. 显示"添加引用"对话框。选择OpenNETCF.Desktop.Communication组件。
  4. 单击OK按钮,将所选组件添加到项目中。

这是我的代码:

     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#"

你知道我该怎么做吗?

无法找到PInvoke DLL kernel32.dll文件c#

您应该使用RAPI2。RAPI2取代RAPI