简体   繁体   English

找不到PInvoke DLL kernel32.dll文件C#

[英]Can not find PInvoke DLL kernel32.dll file C#

I'm trying to conect my phone device vía USB to a server to transmit data. 我正在尝试将我的手机设备与USB到服务器以传输数据。

I'm Working with RAPI , this is my code; 我正在使用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;

I added the OpenNETCF.Desktop.Communication by following the next steps: 我按照以下步骤添加了OpenNETCF.Desktop.Communication

  1. In the Solution Explorer window, right-click the References folder. 在“解决方案资源管理器”窗口中,右键单击“引用”文件夹。 A pop-up menu displays. 将显示一个弹出菜单。
  2. From the menu, select Add Reference. 从菜单中,选择“添加引用”。
  3. The Add Reference dialog box displays. 将显示“添加引用”对话框。 Select the OpenNETCF.Desktop.Communication component. 选择OpenNETCF.Desktop.Communication组件。
  4. Click the OK button to add the selected component to your project. 单击“确定”按钮将所选组件添加到项目中。

And this is my code: 这是我的代码:

     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();
            } 

The problem it shows me is 它告诉我的问题是

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

Any idea about what could I do? 关于我能做什么的任何想法?

You should use RAPI2 instead. 您应该使用RAPI2 RAPI2 replaces RAPI. RAPI2取代了RAPI。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM