Checking for attached device ( A: drive? )
-
Howdy out there! Without going into too much detail, I need to keep track of the drives -- to know if anything is attached, and if so what. Currently (on a timer) I am use a combination of GetVolumeInformation and FindFirstFile -- to both get volume information and make sure that the device is readable. I am already processing device events to get changes, but still periodically I also scan all the drives. For most users, my scheme isn't a problem. But, I have a user who is reporting activity on their A: drive periodically. What's the best way to check the drive without being annoying to the user? Do you think I am doing too much by trying to read the drive root? Is there a good alternative to reading the drive root to verify the contents of a drive?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [SoonR Inc -- PC Power delivered to your phone](http://www.soonr.com)
-
Howdy out there! Without going into too much detail, I need to keep track of the drives -- to know if anything is attached, and if so what. Currently (on a timer) I am use a combination of GetVolumeInformation and FindFirstFile -- to both get volume information and make sure that the device is readable. I am already processing device events to get changes, but still periodically I also scan all the drives. For most users, my scheme isn't a problem. But, I have a user who is reporting activity on their A: drive periodically. What's the best way to check the drive without being annoying to the user? Do you think I am doing too much by trying to read the drive root? Is there a good alternative to reading the drive root to verify the contents of a drive?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [SoonR Inc -- PC Power delivered to your phone](http://www.soonr.com)
ouch - thats a hard one there a few ways of enumerating drives etc and determining if they are floppy, fixed drives etc .. the issue likely comes about if floppy's are detected because you then attempt to read from it, which is going to cause activity do you really need to check floppy drives ? or can you say if its a floppy drive and through a parameter eg environment variable dont attempt to read it ?
Peter Weyzen wrote:
Do you think I am doing too much by trying to read the drive root?
there's not enough context into the why for (tlbd) to say ... I was thinking that maybe you can detect media inserted (or not) into a floppy drive, and dont scan it if there's no media there - but even that might cause activity sorry, not much help, brain thinking out loud ... 'g'
-
ouch - thats a hard one there a few ways of enumerating drives etc and determining if they are floppy, fixed drives etc .. the issue likely comes about if floppy's are detected because you then attempt to read from it, which is going to cause activity do you really need to check floppy drives ? or can you say if its a floppy drive and through a parameter eg environment variable dont attempt to read it ?
Peter Weyzen wrote:
Do you think I am doing too much by trying to read the drive root?
there's not enough context into the why for (tlbd) to say ... I was thinking that maybe you can detect media inserted (or not) into a floppy drive, and dont scan it if there's no media there - but even that might cause activity sorry, not much help, brain thinking out loud ... 'g'
Thanks for your thoughts. I already listen to the device change events -- but one can never trust those to be completely accurate. Is there a way to differentiate "removable" drives from "floppy" drives? Some day, there will be no more floppy drives and my problem will go away!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [SoonR Inc -- PC Power delivered to your phone](http://www.soonr.com)
-
Thanks for your thoughts. I already listen to the device change events -- but one can never trust those to be completely accurate. Is there a way to differentiate "removable" drives from "floppy" drives? Some day, there will be no more floppy drives and my problem will go away!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [SoonR Inc -- PC Power delivered to your phone](http://www.soonr.com)
Peter Weyzen wrote:
Is there a way to differentiate "removable" drives from "floppy" drives?
Im pretty sure there is - but cant search for the info right now - I did have a great article on doing such 'g'
-
Peter Weyzen wrote:
Is there a way to differentiate "removable" drives from "floppy" drives?
Im pretty sure there is - but cant search for the info right now - I did have a great article on doing such 'g'
-
Howdy out there! Without going into too much detail, I need to keep track of the drives -- to know if anything is attached, and if so what. Currently (on a timer) I am use a combination of GetVolumeInformation and FindFirstFile -- to both get volume information and make sure that the device is readable. I am already processing device events to get changes, but still periodically I also scan all the drives. For most users, my scheme isn't a problem. But, I have a user who is reporting activity on their A: drive periodically. What's the best way to check the drive without being annoying to the user? Do you think I am doing too much by trying to read the drive root? Is there a good alternative to reading the drive root to verify the contents of a drive?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [SoonR Inc -- PC Power delivered to your phone](http://www.soonr.com)
When you insert a CD or DVD, Windows will send a
WM_DEVICECHANGE
message. Does the same thing happen for a floppy disk?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
sure they can be used to determine what drives you've got - the Setup API can also do it ... but they cant tell you wether there's media in a floppy drive for example (personally I'd disconnect the floppy drives - but thats skirting his/customers issue) 'g'
-
Howdy out there! Without going into too much detail, I need to keep track of the drives -- to know if anything is attached, and if so what. Currently (on a timer) I am use a combination of GetVolumeInformation and FindFirstFile -- to both get volume information and make sure that the device is readable. I am already processing device events to get changes, but still periodically I also scan all the drives. For most users, my scheme isn't a problem. But, I have a user who is reporting activity on their A: drive periodically. What's the best way to check the drive without being annoying to the user? Do you think I am doing too much by trying to read the drive root? Is there a good alternative to reading the drive root to verify the contents of a drive?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [SoonR Inc -- PC Power delivered to your phone](http://www.soonr.com)
Peter - have a look at CFileTreeCtrl from PJ Naughter - he has a comment under updates [v1.09 (18 July 2000)] "Code has been made smarter so that it does not have to spin up the floppy disk to determine if there are files on it. It now initially displays a "+" and only when you try to expand it will it do the actual scan. " Maybe not having to 'Spin Up' means the user also doesnt see the floppy/select light come on ! http://www.naughter.com/filetreectrl.html[^] 'g'