Detecting memory card insertion/removal

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

Hello everyone,

I was wondering if anyone knew of a way to detect a memory card's
insertion and/or removal from a PocketPC 2003? I'm looking for a way to
do this (even with P/Invoke) that doesn't involve me constantly polling
the slot.

Any help would be appreciated.

Thanks in advance,
Michael
 
You can use the RequestDeviceNotifications() API with P/Invoke. Not sure if
the OpenNetCF libraries have anything for that or not.
 
There's nothing present now. However, since the NDIS AdapterStatusMonitor
class already does this basic operation, I'm creating a new
DeviceStatusMonitor class for catching this type of notification. I'll
probably have something in the Vault by the end of the day...

Paul T.
 
OK, it's done. To use this, get the new sample, StorageCardMonitor, from
the Samples folder in the Vault. Also, you'll need the latest GuidEx.cs (at
least, if not other things), from the basic OpenNETCF folder and the latest
files from OpenNETCF.Net. The sample shows how to detect insertion and
removal of storage cards.

Paul T.
 
Great! Thanks for the info Steve. I guess I'll have to wait until .NET
v2.0 for the managed version of the notification API.

Ciao,
Michael
 
Wow! Excellent! Thank you very much Paul. I've looked over the code - it
looks good. I'm going to have to look into the OpenNetCF library though,
as I'm not familiar with it at all.

As a follow-up question: I actually don't have a Pocket PC to test this
code out on yet - is it possible to trigger the event in the emulator
during debug somehow? I mean, am I able to raise device-level events
such as this programmatically, or are they protected in some way (both
with and without the emulator)?

Anyway, thanks again for your help with this. It's my first time posting
here, and my first impression is that you guys are great!

I hope I'll be able to start contributing soon.

Ciao,
Michael
 
The emulator allows mounting folders from the host OS into the system and
that will appear as a storage card insertion you can detect.
 
Back
Top