Sometimes we need to open the Storage Card of the device and get a handle, we can use the CreateFile API for that by giving the file name as “Storage CardVol:”. The problem with this approach is that we are hard coding the name of the storage card which may not be same for all devices. We can overcome this by using the API FindFirstFlashCard and FindNextFlashCard APIs. These APIs enumerate the flash cards and return the details in WIN32_FIND_DATA structure. The name of the card can be found in the cFileName member of the structure. The code snippet below enumerate the flash cards and insert the name in to a CListCtrl:

HANDLE hFind = FindFirstFlashCard(&wfd);
BOOL bContinue = (INVALID_HANDLE_VALUE != hFind);
int nItem = 0;
int nIndex = 0;

nItem = pList->InsertItem(nIndex,wfd.cFileName);

bContinue = FindNextFlashCard(hFind,&wfd);