I thought it would be a straight forward API call of the shell32.dll but I cannot for the life of me figure out how to use shell32.dll to do what I need it to do. Part of this is due to the fact that I can't find any code that comes close to even referencing what I am trying to do, even though I have perused the MSDN documentation...I may be in over my head here.
To be specific, I am writing an application that monitors a USB Card Reader and will automatically format anything inserted into the Reader, (for the more security wary among us, this application is for industry use and is needed to process hundreds of memory cards a day, hence the need for automation).
Before replies talking up WM_DEVICECHANGE start pouring in, be aware that this doesnt work for a memeory card reader when trying to detect an inserted MEMORY CARD.
WM_DEVICECHANGE will only pick up on changes when the CARD READER ITSELF is added or removed.
So while researching my needs I found references to shell32.dll and its ability to monitor media inserts and removals by using the CHANGENOTIFY. But after a week of trying various code I still have not gotten any credible results. The majority of stuff is in CPP and even the stuff I found in VB is for VB6. And none of it addresses what I need.
To bridge the current gap I am using WMI Queries to check the drives themselves and look for inserted media, and while this works for my purposes, it is EXTREMELY resource intensive as it is simply a looping query.
I know I should have some shell32 related code to post in order to even start a discussion, but I am at a loss in even where to begin.
I am posting in the hope that SOMEONE has had experience using shell32 and may be able to give me some ideas on how to apply it.
I appreciate any feedback.