Let the games begin.

VB Code:
  1. Function CountLines( _
  2.     ByRef pszFilename As String, _
  3.     ByVal fUnicode As Boolean _
  4. ) As Long
  5.  
  6. Dim hFile       As Long
  7. Dim lFilelen    As Long
  8. Dim lpPos       As Long
  9. Dim chBuf()     As Byte
  10.  
  11. Dim lMax        As Long
  12. Dim i           As Long
  13. Dim lStep       As Long
  14.  
  15. Const CHUNKSIZE = 1024
  16.  
  17.     hFile = FreeFile()
  18.     Open pszFilename For Binary Lock Write As #hFile
  19.  
  20.     lFilelen = LOF(hFile)
  21.     ReDim chBuf(CHUNKSIZE)
  22.  
  23.     lStep = -fUnicode + 1
  24.  
  25.     Do While (lpPos < lFilelen)
  26.         If ((lFilelen - CHUNKSIZE) < lpPos) Then _
  27.             ReDim chBuf(lFilelen - lpPos)
  28.  
  29.         Get #hFile, lpPos + 1, chBuf
  30.  
  31.         lMax = UBound(chBuf)
  32.         For i = 0 To lMax Step lStep
  33.             If (chBuf(i) = 13) Then _
  34.                 CountLines = CountLines + 1
  35.         Next i
  36.  
  37.         lpPos = lpPos + CHUNKSIZE
  38.     Loop
  39.  
  40.     Close #hFile
  41.  
  42. End Function

I haven't tried optimising it yet, but it's a start