Solved

is the usb inserted and the driver loaded, delphi programming

Posted on 2011-03-08
4
506 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 37

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Create a path if not exists 7 108
Delphi inherited method 6 78
Tembedded WB animatid gifs not animated on some pcs 2 86
Delphi Yen format 3 59
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

763 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