大意如下:procedure TForm1.cmdGetAllEnrollData_Click(Sender: TObject);var vEnrollNumber: Integer; vBackupNumber: Integer; vPrivilege: Integer; vnEnableFlag: Integer; vnMessRet: Integer; vTitle: string; vnResultCode: Integer;begin cmdGetAllEnrollData.Enabled := False; lstEnrollData.Clear; vTitle := Me.Caption; lblMessage.Caption := 'Working...'; DoEvents; vnResultCode := frmMain.FKAttend.EnableDevice(0); if vnResultCode <> RUN_SUCCESS then begin lblMessage.Caption := gstrNoDevice; cmdGetAllEnrollData.Enabled := True; Exit; end; vnResultCode := frmMain.FKAttend.ReadAllUserID(); if vnResultCode <> RUN_SUCCESS then begin lblMessage.Caption := ReturnResultPrint(vnResultCode); frmMain.FKAttend.EnableDevice(1); cmdGetAllEnrollData.Enabled := True; Exit; end; MousePointer := vbHourglass; with AdoEnroll.Recordset do begin fbGetState = True do label FFF vnResultCode := frmMain.FKAttend.GetAllUserID(_vEnrollNumber, _vBackupNumber, _vPrivilege, _vnEnableFlag); if vnResultCode <> RUN_SUCCESS then begin if vnResultCode = RUNERR_DATAARRAY_END then vnResultCode = RUN_SUCCESS end if Break label EEE vnResultCode := frmMain.FKAttend.GetEnrollData(_vEnrollNumber, _vBackupNumber, _vPrivilege, _flngFpData(0), _flngPasswordData); if vnResultCode <> RUN_SUCCESS then begin vnMessRet = Application.MessageBox( PChar(ReturnResultPrint(vnResultCode)+': Continue ?'),'GetEnrollData',mbYesNoCancel); if vnMessRet = mrYes then goto EEE else if vnMessRet = mrCancel then Break else goto FFF end; FuncSaveToDB(vEnrollNumber, vBackupNumber, vPrivilege); Me.Caption := IntToStr(vEnrollNumber); DoEvents; // Loop fbGetState := False; DoEvents; if RecordCount > 1 then begin MoveFirst; MoveLast; end; end; Me.Caption := vTitle; MousePointer := vbDefault; if vnResultCode = RUN_SUCCESS then lblMessage.Caption := 'GetAllEnrollData OK' else lblMessage.Caption := 'GetAllEnrollData Error: ' + ReturnResultPrint(vnResultCode); frmMain.FKAttend.EnableDevice(1); cmdGetAllEnrollData.Enabled := True;end;