Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello programmers
i m developing an application which runs from a dongle or USB....
if that dongle or usb removed from pc then application should be exit.
I want to give copy right protection like one application can be installed in one pc only.

now i dont know how to do all this...... i want to know which port contains a dongle in which my application is isntalled.

if u can give me any example then it is better.

thanx in advance
Posted

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900