如何通过USB连接我的设备 [英] How to connecting my device via USB
本文介绍了如何通过USB连接我的设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个C#Windows移动应用程序。我将我的应用程序连接到服务器以获取和发送数据,víaWIFI,你知道:
I'm developing a C# Windows mobile application. I connect my app to a server to get and send data, vía WIFI, you know:
SqlConnection conn = new SqlConnection("server =" + myIP.Text + "," + myPort.Text + ";integrated security=false;Initial Catalog=" + myBD.Text + ";User ID=" + MyUss.Text + ";Password=" + myPass.Text + ";Trusted_Connection=False;");
它的确有效!我没有问题。我想做的是
通过USB连接
我一直在寻找它,我找到了RAPI我找到了一个带有USB连接的桌面应用程序(它可以工作!),但现在我想在我的移动应用程序中做同样的事情,但它不起作用。
这是我的代码:
And it works! I have not problem with this. What I wanna do is
Connecting by USB
I was looking for it, and I found the RAPI And i found a desktop app with USB connection (and it works!), but now I'm trying to do the same in my mobile app, but it doesnt work.
Here's my code:
using OpenNETCF.Desktop.Communication;
//code lines
public void usb()
{
try
{
string file = @"C:\Users\DUno\Documents\AAF\test.txt";
OpenNETCF.Desktop.Communication.RAPI myrapi = new OpenNETCF.Desktop.Communication.RAPI();
while (!myrapi.DevicePresent)
{
MessageBox.Show("No device detected");
myrapi.Connect();
}
}
catch (Exception exc)
{
MessageBox.Show("Error: " + exc.Message);
}
}
以及它给我看的消息:
and the messages it shows me:
No se puede encontrar el archivo DLL PInvoke ‘kernel32.dll’
No se puede encontrar el archivo DLL PInvoke ‘rapi.dll’
所以..对我能做什么的任何想法?
我关注的网站如这
推荐答案
这篇关于如何通过USB连接我的设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文