m_tID, Len(m_tID), dwBytesWritten, ByVal 0&amp;
      If (dwBytesWritten = Len(m_tID)) Then
         ' Write the ICONDIRENTRY structures:
         For iEntry = 0 To m_tID.idCount - 1
            WriteFile hFile, m_tIDE(iEntry), Len(m_tIDE(iEntry)),
             dwBytesWritten, ByVal 0&amp;
            If (dwBytesWritten &lt;&gt; Len(m_tIDE(iEntry))) Then
               bFail = True
               Exit For
            End If
         Next iEntry
         ' Write the icon bits:
         If Not (bFail) Then
  