Solved

is the usb inserted and the driver loaded, delphi programming

Posted on 2011-03-08
4
508 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 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month11 days, 17 hours left to enroll

623 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