Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1385
  • Last Modified:

Detect event of SD Card Reader/Writer

I’m developing a Windows application that uses a SD card reader/writer.

Here’s what I want to do;
1.      When a user inserts a SD card to the reader I want my program to be notified about this event.
2.      When a user removes the SD card the program also get notified about this event.

I would be most thankful if anyone could provide with example codes.
0
csound
Asked:
csound
  • 2
1 Solution
 
mahesh1402Commented:
>>When a user inserts a SD card to the reader I want my program to be notified about this event.

you may use WM_DEVICECHANGE message for this...

The system sends the DBT_DEVICEARRIVAL device message when a device has been inserted and becomes available.

To send the DBT_DEVICEARRIVAL device message, the system sends the WM_DEVICECHANGE message with wParam set to DBT_DEVICEARRIVAL and lParam set to the address of a DEV_BROADCAST_HDR structure identifying the device inserted.

The WM_DEVICECHANGE device message notifies an application of a change to the hardware configuration of a device or the computer.

>>When a user removes the SD card the program also get notified about this event.

The system sends the DBT_DEVICEREMOVECOMPLETE device message when a device has been removed

You may refer this sample project with src code : http://www.codeproject.com/w2k/usbdisks.asp <==

-MAHESH
0
 
mahesh1402Commented:
This is another sample code for 'How To Getting Notification of CD-ROM Insertion or Removal'

http://support.microsoft.com/default.aspx?scid=kb;en-us;163503 <==

You may use this for any hardware device add/remove notifications.

-MAHESH
0
 
csoundAuthor Commented:
Thank you for you help!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now