void CTestFaceServerSdkDlg::OnEventCEnrollUserFaceserversdkctrl1(
LPCTSTR strDevSn , //终端序列号 m_devSn
long lOpCode , //操作标识 OP_SUCC=0 成功 OP_FAIL=1 失败
long lUserData , //用户传进来的自定义数据
long lExtendParam , //扩展参数
long lUserId , //用户编号
LPCTSTR strCardNo , //卡号
long lFeatureLen , //特征码原始长度
LPCTSTR strBase64FeatureData , //经过BASE64编码的特征数据
long lPhotoType , //照片类型保留
long lPhotoLen , //照片原始数据长度
LPCTSTR strBase64PhotoData //经过BASE64编码的照片数据
)
{
// TODO: 在此处添加消息处理程序代码
if(lPhotoLen > 0)
{
MessageBox( _T( "人脸登记成功" ) );
int nBase64PhotoLen = wcslen( strBase64PhotoData );
if(nBase64PhotoLen > 1024)
{
char szBuffer[ BUF_LEN ] = { 0 };
char* pDst = szBuffer;
CBase64 * cBase64 = new CBase64;
int nDstLen = cBase64->DecodeBase64( (const char*)( CW2A( strBase64PhotoData ) ) , (unsigned char*)pDst , nBase64PhotoLen );
CString strSuffix;
strSuffix.Format( _T( "%d" ) , lUserId );
CString strFileName;
SYSTEMTIME sys;
GetLocalTime( &sys );
strFileName.Format( _T( ".\\PHOTO_%s_%04d%02d%02d%02d%02d%02d%03d_%s.jpg" ) , _T( "GetUserInfo" ) , sys.wYear , sys.wMonth , sys.wDay , sys.wHour , sys.wMinute , sys.wSecond , sys.wMilliseconds , strSuffix );
CFile file;
CFileException ex;
if(file.Open( strFileName , CFile::modeWrite | CFile::shareExclusive | CFile::modeCreate , &ex ))
{
file.Write( szBuffer , nDstLen );
file.Flush();
file.Close();
}
}
}
}