与USB端口交互..... [英] interacting with USB ports.....

查看:85
本文介绍了与USB端口交互.....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好程序员
我正在开发从 dongle USB .......运行的应用程序. 如果从PC上删除了加密狗或USB,则应退出应用程序.
我想给c opy权限保护,就像一个应用程序只能安装在一台PC中一样.

现在我不知道该怎么做……我想知道哪个端口包含一个加密狗,在其中安装了我的应用程序.

如果您能给我任何例子,那就更好了.

如果您阅读Application.ExecutablePath,将为您提供启动该程序的应用程序文件的磁盘参考.因此,如果您的程序名为WhereAmI.exe,并且位于显示为"H"驱动器的USB上,则Application.ExecutablePath将为您提供

 H:\ WhereAmI.exe 


您可以使用它来监视USB的移除: http ://www.cybersprocket.com/2011/programming-languages/detecting-usb-insertionremoval-in-c-net-4-0/ [ 解决方案

If you read Application.ExecutablePath, it gives you the disk reference for the application file that started the program. So if you program is called WhereAmI.exe and it is on a USB that appears as the "H" drive, Application.ExecutablePath will give you

H:\WhereAmI.exe


You can use this to monitor for USB removal:
http://www.cybersprocket.com/2011/programming-languages/detecting-usb-insertionremoval-in-c-net-4-0/[^] gives the basic code. It''s in C#, but it''s pretty obvious.


这篇关于与USB端口交互.....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆