SD Card Insertion Detection

A

allanster.a

Hello,
Can some one guide me as to how i could detect SD card
insertion, ie when ever the SD card is inserted it should start an
application. The application is copying a few files from the SD card
to the phone. The application is written in c# and i am using a imate
ppc 2003 2nd edition phone.

Thanks and Regards,
Allen
 
A

allanster.a

Hi,

'CERunAppAtEvent'.. works perfectly.. but there is a small problem..
an event is also generated everytime the card is removed, which causes
my program to run again.. is it some how possible to detect only card
insertion and not removal??

Thanks
Allen
 
N

Neil Cowburn

You should take a look at using SHChangeNotifyRegister with
SHCNE_MEDIAINSERTED. If you're not comfortable with P/Invoke, drop me a
mail.

--
Neil Cowburn
Principal Partner
OpenNETCF Consulting, LLC.

http://www.opennetcf.com/
 
G

Guest

is it some how possible to detect only card
insertion and not removal??

The easiest thing to do... when your autorun.exe file runs, make
sure the first thing it does is to check for command line parameters
passed to it.

When your device starts an autorun.exe when you've inserted
a card, it passes the "install" parameter (without the speechmarks!).

When it starts it when you've just removed a memory card, it
passes the "uninstall" parameter.

Another giveaway is to have a look at which directory your
autorun.exe is being run from. When you remove your memory
card, the device typically runs it from the "\Windows" directory,
or one of it's subdirectories.

Hope this helps.


James
www.pocketpcinstaller.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top