Advertisement
Guest User

Untitled

a guest
Jun 15th, 2015
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. // NEW COMMAND-LINE INCLUDE
  2. #include "stdafx.h"
  3.  
  4. class CNewCommandLineInfo : public CCommandLineInfo
  5. {
  6. public:
  7.     CString m_sHostAddr;
  8.     UINT    m_nPort;
  9.  
  10.     void ParseParam(LPCTSTR lpszParam, BOOL bFlag, BOOL bLast);
  11. };
  12.  
  13. void CNewCommandLineInfo::ParseParam(LPCTSTR lpszParam, BOOL bFlag, BOOL bLast)
  14. {
  15.     if(bFlag) {
  16.         CString sParam(lpszParam);
  17.         if (sParam.Left(2) == "h:") {
  18.             m_sHostAddr = sParam.Right(sParam.GetLength() - 2);
  19.             return;
  20.         }
  21.  
  22.         if (sParam.Left(2) == "p:") {
  23.             CString sTemp;
  24.  
  25.             sTemp = sParam.Right(sParam.GetLength() - 2);
  26.             m_nPort = atoi(sTemp);
  27.             return;
  28.         }
  29.     }
  30.  
  31.     // Call the base class to ensure proper command line processing
  32.     CCommandLineInfo::ParseParam(lpszParam, bFlag, bLast);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement