BOOL CALLBACK bckVerifyDlgProc
( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
bCkRESULT bpRC = BIOCHEC_OK;
switch (uMsg)
{
case WM_CLOSE:
myBCK.HookStatusMsg(NULL);
myBCK.UnhookAll();
break;
case WM_INITDIALOG:
myBCK.HookField(GetDlgItem(hwndDlg,IDC_PASSPHRASE),_T("Passphrase"));
myBCK.setFieldLen(_T("Passphrase"),8,32);
SetDlgItemText(hwndDlg,IDC_PASSPHRASE,_T(""));
myBCK.HookStatusMsg(GetDlgItem(hwndDlg,IDC_MSG));
SetFocus(GetDlgItem(hwndDlg, IDC_PASSPHRASE));
return FALSE;
case WM_COMMAND:
if (wParam==IDOK)
{
myBCK.HookStatusMsg(NULL);
SetFocus(GetDlgItem(hwndDlg,IDOK)); // necessary for bioChecKey
bpRC = myBCK.StoreSample();
if ( bpRC == BIOCHEC_OK )
{
LPBYTE bpSignature = myBCK.CreateSignature();
if ( bpSignature )
{
double dScore = myBCK.VerifySignature(bpSignature,bpTemplate);
myBCK.FreeSignature(bpSignature);
int iMin = 0;
bpRC = myBCK.getLastError();
if ( bpRC == BIOCHEC_OK )
{
iMin = myBCK.iConvertToScale(10,dScore,BCK_DEFAULT_THRESHOLD);
if ( iMin >= 3 /*bioMinStrength*/ )
{
/* ... do something nice here ... */
EndDialog(hwndDlg,IDOK);
return(TRUE);
}
}
}
}
myBCK.resetFields();
SetDlgItemText(hwndDlg,IDC_PASSPHRASE,_T(""));
SetFocus(GetDlgItem(hwndDlg,IDC_PASSPHRASE));
myBCK.HookStatusMsg(GetDlgItem(hwndDlg,IDC_MSG));
return(TRUE);
} // if (wParam==IDOK)
return TRUE;
} // switch (uMsg)
return FALSE;
}
|