Page 232 - PDA Robotics Using Your Personal Digital Assistant to Control Your Robot
P. 232
PDA 10 5/27/03 8:51 AM Page 208
m_WndProgressCtrl.StepIt();
m_csHost=szHost; PDA Robotics
}
}
void CBeamDlg::ProcessPendingRead()
{
char szUserName[255];
char szPassword[255];
m_pClientSocket->Receive(szUserName,255,0);
m_pClientSocket->Receive(szPassword,255,0);
m_WndProgressCtrl.StepIt();
GetDlgItem(IDC_STATUS_STATIC)->SetWindowText("Authenticating..");
if(!CheckForAuthentication(szUserName,szPassword))
{
m_pClientSocket->Send("ERROR",255,0);
GetDlgItem(IDC_STATUS_STATIC)->SetWindowText("Bad user name or password..");
}
else
{
//Recv the instant message here
m_pClientSocket->Send("SUCCESS",255,0);
///play sound to inform the user
PlaySound("wireless.wav",NULL,SND_FILENAME);
}
}
BOOL CBeamDlg::CheckForAuthentication(char * pszUserName,char *pszPassword)
{
WCHAR szUserName[100];
WCHAR szPassWord[100];
//
//Convert to unicode
//
MultiByteToWideChar(CP_ACP, 0, pszUserName,
strlen(pszUserName)+1, szUserName,
sizeof(szUserName)/sizeof(szUserName[0]) );
//
//Convert to unicode
//
MultiByteToWideChar(CP_ACP, 0, pszPassword,
208