WIN32_FIND_DATA (Structures)
Last changed: -62.91.108.152

.

int index;

// Total number of storage cards found.

int iNumOfFlashCard = 0;

// Maximum number of storage cards to find.

int iMaxCards = 10;

// Whether to continue searching after finding a card.

BOOL bContinue = TRUE;

// Search handle for storage cards.

HANDLE hFlashCard;

// Structure for storing card information.

WIN32 *lpwfdFlashCard;

// Structure for storing card information temporarily.

WIN32 *lpwfdFlashCardTmp;

lpwfdFlashCardTmp = (WIN32 *) LocalAlloc

            (LPTR, iMaxCards * sizeof (WIN32_FIND_DATA));

// Test for failed memory allocation.

if (lpwfdFlashCardTmp == NULL)

   return;

hFlashCard = (&lpwfdFlashCardTmp 0);

if (hFlashCard == INVALID_HANDLE_VALUE)

{

// Free the memory.

   LocalFree (lpwfdFlashCardTmp);  
   return;

}

while (bContinue)

{

   iNumOfFlashCard += 1;
   // Search for the next storage card.
   bContinue =  (hFlashCard,
           &lpwfdFlashCardTmp [iNumOfFlashCard]);

}

// Close the search handle.

FindClose (hFlashCard);

if (iNumOfFlashCard > 0)

{

   // Allocate memory for lpwfdFlashCard.
   lpwfdFlashCard = (WIN32_FIND_DATA *) LocalAlloc
            (LPTR, iNumOfFlashCard * sizeof (WIN32_FIND_DATA));
   // Test for failed memory allocation.
   if (lpwfdFlashCard == NULL)  
   {
   // Free the temp card memory.
      LocalFree (lpwfdFlashCardTmp);  
      return;
   }
   // Assign lpwfdFlashCardTmp to lpwfdFlashCard.
   for (index=0; index < iNumOfFlashCard; ++index)
   {
    lpwfdFlashCard [index] = lpwfdFlashCardTmp [index];
   }

// Free the memory.

   LocalFree (lpwfdFlashCard);  

}

LocalFree (lpwfdFlashCardTmp

FOR VB.net the Structure should be declared as follows

{Public or Private is your choice}

    Public Structure WIN32_FIND_DATA
    Public dwFileAttributes As Integer
    Public ftCreationTime As FILETIME
    Public ftLastAccessTime As FILETIME
    Public ftLastWriteTime As FILETIME
    Public nFileSizeHigh As Integer
    Public nFileSizeLow As Integer
    Public dwReserved0 As Integer
    Public dwReserved1 As Integer
    <Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.ByValTStr,  SizeConst:=260)> _
    Public cFileName As String
    <Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=14)> _
    Public cAlternate As String
    End Structure

For FILETIME

   Public Structure FILETIME
    Public dwLowDateTime As Integer
    Public dwHighDateTime As Integer
   End Structure