BOOL (CALLBACK* pfnAskPassword) (FVSDK_CALLBACK_DATA pvAskPasswordData, char* pszBuffer, int nBufferSize)
Called when the FTP Voyager SDK needs to ask for a password while connecting to a server.
pvAskPasswordData
The DWORD value set in the FVSDK_Session structure. The meaning of this value is application defined.
pszBuffer
If TRUE is returned, pszBuffer is a NULL terminated string containing the password (usually entered by an end user). This string is initially all zeros.
nBufferSize
The maximum number of bytes allocated in pszBuffer. The maximum string length can only be nBufferSize because the caller allocates up to one extra byte for the NULL terminator.
Return TRUE to continue with the connection attempt or FALSE to quit the connection.
BOOL CALLBACK OnAskPassword(FVSDK_CALLBACK_DATA pvAskPasswordData, LPCTSTR pszBuffer, int nBufferSize)
{
CAskPasswordDlg Dlg;
BOOL bRet;
// ask the user for the password
if (Dlg.DoModal() == IDOK) {
// copy over the user's password
strncpy(pszBuffer, Dlg.m_sPassword, nBufferSize);
// yes, continue with the connection
bRet = TRUE;
} // if
else
bRet = FALSE;
// return TRUE to continue the connection attempt, otherwise FALSE
return (bRet);
} // OnAskPassword