On Error GoTo ErrLabel
    
    iFreeFile = FreeFile
    Open FileName For Binary As #iFreeFile
    
    Get #iFreeFile, &H43, bytFile
    Get #iFreeFile, &H9D, bytVer
    Get #iFreeFile, &H15, bytDB_ID
    Get #iFreeFile, &H5, sFileFlag
    
    Close #iFreeFile
    
    If sFileFlag <> "Delphi" Then
      MsgBox "没有找到"
      GoTo Endlabel
    End If

解决方案 »

  1.   

    var
    file:Tfile;
    ifreefile:string;
    begin
      try
        ifreefile:=freefile;
        file:=openfile(ifreefile,....);
       // 下面的不知什么意思了,呵呵
       closefile(file);
      except
      end;
    end;
      

  2.   

    下面是变量的定义
    Dim bytVer(2)      As Byte
        Dim bytDB_ID       As Byte
        Dim bytFile(39)    As Byte
        Dim iFreeFile      As Integer
        Dim sFileFlag      As String * 15
      

  3.   

    VB版的回答On Error GoTo ErrLabel    '如果程序執行出錯則跳到ErrLabel
        
        iFreeFile = FreeFile   '得到一個空閑的文件號
        Open FileName For Binary As #iFreeFile   '以二進制方式打開文件
        
        Get #iFreeFile, &H43, bytFile   '從第67字節開始,讀入len(bytFile)個字節的數據至
                                                bytFile
        Get #iFreeFile, &H9D, bytVer
        Get #iFreeFile, &H15, bytDB_ID
        Get #iFreeFile, &H5, sFileFlag  '同上
        
        Close #iFreeFile  '關閉文件
        
        If sFileFlag <> "VB" Then
          MsgBox "没有找到"
          GoTo Endlabel
        End If