private bool GetFrCardNo(ref string CardNo) { int vnRet = 0; bool ret = false; byte[] RECardNo = new byte[256]; for (int i = 0; i < ObjFpReader.PISFP_MAX_DEVICE_COUNTS; i++) { byte[] vstrDeviceDescription = new byte[1024]; byte[] vstrDevId = new byte[1024]; if (ObjFpReader.pisEnumerateDevice(i, vstrDevId, vstrDeviceDescription) == ObjFpReader.PISFP_OK) { devIdList.Add(Encoding.Default.GetString(vstrDevId, 0, vstrDevId.Length)); } } if (devIdList.Count > 0) { Exit(); vnRet = ObjFpReader.pisCreateContext(ref contextId); vnRet = ObjFpReader.pisOpenDevice(contextId, devIdList[0]); if (vnRet != 0) { Exit(); return(ret); } // vnRet = ObjFpReader.pisGetCardNumber(contextId, RECardNo ); //控制设备灯 RECardNo = new byte[256]; Application.DoEvents(); vnRet = ObjFpReader.pisGetCardNumber(contextId, RECardNo); if (vnRet == ObjFpReader.PISFP_GET_CARD) { System.Threading.Thread.Sleep(10); } if (vnRet == 0) { CardNo = Pub.GetWGCardNo(RECardNo); ret = true; } Exit(); } return(ret); }