Page 229 - PDA Robotics Using Your Personal Digital Assistant to Control Your Robot
P. 229

PDA 10  5/27/03  8:51 AM  Page 205
                                             Chapter 10 / The PDA Robotics Command Center
                                   CString strFtpSite;
                                   CString strServerName;
                                   CString strObject;
                                   INTERNET_PORT nPort;
                                   DWORD dwServiceType;
                                   // If the user has provided all the information in the
                                   // host line then dwServiceType, strServerName, strObject, nPort will
                                   // be filled in.. but since I've provided edit boxes
                                   // for each we will use these.
                                   //
                                   // Ensure Valid connection parameters
                                   //

                                   CString diagnostic_msg = "";
                                   if ( host.IsEmpty() )
                                   {
                                      diagnostic_msg = " check Host ";
                                   }
                                   if ( ( user.IsEmpty()) || (user == "") )
                                   {
                                      diagnostic_msg = " check Username ";
                                   }

                                   if ( password.IsEmpty() )
                                   {
                                      diagnostic_msg = " check password ";
                                   }

                                   if ( port < 1 )
                                   {
                                      diagnostic_msg = " check port ";
                                   }
                                   // Now open an FTP connection to the server
                                   try
                                   {
                                      m_pFtpConnection = m_pInetSession->GetFtpConnection(host, user, password, port );
                                   }

                                   catch (CInternetException* pEx)
                                   {
                                      // catch errors from WinINet
                                      TCHAR szErr[1024];
                                      if (pEx->GetErrorMessage(szErr, 1024))
                                      {
                                        // AfxMessageBox(szErr, MB_OK);
                                        status_msg += diagnostic_msg;
                                        status_msg += szErr;

                                                                                               205
   224   225   226   227   228   229   230   231   232   233   234