Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

is the usb inserted and the driver loaded, delphi programming

Posted on 2011-03-08
4
Medium Priority
?
512 Views
Last Modified: 2012-05-11
a USB device is inserted into usb port on WinXP computer. in reponse the operating system loads the necessary drivers.

My program is communicating to this usb device using the loaded driver. My problem is to determine if the device has been inserted into the USB and/or if the driver is loaded by the operating system.

If I just go ahead and access the driver before it is initialized I get an access violation. also I need to find a mechanism to detect if the user has removed the device again.

0
Comment
Question by:HLyder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 38

Accepted Solution

by:
Geert Gruwez earned 2000 total points
ID: 35074407
0
 
LVL 7

Expert Comment

by:samenglish
ID: 35074571
There is some Delphi code here
http://www.swissdelphicenter.ch/torry/showcode.php?id=2211
http://www.delphi3000.com/articles/article_4841.asp?SK=
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_24135127.html
http://answers.yahoo.com/question/index?qid=20060703000208AAvsSaN

And more helpful information from a .NET perspective (sometimes you learn more from that than by just looking at sample code)
http://www.developerfusion.com/article/84338/making-usb-c-friendly/
http://social.msdn.microsoft.com/Search/en-GB/?Refinement=126&Query=how+to+detect+usb+device

To deal with the AVs, just enclose your usb related code in a try except block. Try to resist the urge to use the throwing of an exception as an indicator of the device being removed !
0
 

Author Closing Comment

by:HLyder
ID: 35074986
Both responses where usefull, but first-come first serve
0
 
LVL 25

Expert Comment

by:epasquier
ID: 35080152
HLyder, actually you can select multiple answers and share points as you wish, no need to be binary
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question