Does anyone know how to use the Windows Api in C to detect whether an SD Card reader has a card inserted or not?
Platform: windows xp/visa/7/8.
I've had a google around and a look at the Windows API Doc (which i'm unfamiliar with so probably missed a lot) and have been unable to find an answer.
I've had a look at this post How can I detect when an SD card is plugged in? - which was close but didn't give me what i needed as i don't want to detect a change in state, rather what state it is in at the time of query.
(If by blind chance someone has an Ada implementation of this, that would be amazing, otherwise i plan to just link with C)
Thank you for any help
Matt
I fixed this using windows api call GetVolumeInformation which returns 0 if the drive is not ready. The advantage of using GetVolumeInformation over GetFileAttributes was that GetVolumeInformation is silent, where as GetFileAttributes will cause windows to popup a box saying the drive is empty if it can't find the file. There may be a cleaner way of doing this - but this is working for me now :)
Thank you for the help!