1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- #include "StdAfx.h"
- #include "CommandLineInfoEx.h"
- CCommandLineInfoEx::CCommandLineInfoEx(void)
- {
- }
- CCommandLineInfoEx::~CCommandLineInfoEx(void)
- {
- }
- bool CCommandLineInfoEx::GetWindowHandle(string& strWindowHandle)
- {
- strWindowHandle = m_strWindow;
- if (strWindowHandle.length() == 0)
- {
- return false;
- }
- return true;
- }
- void CCommandLineInfoEx::ParseCommandLine(CCommandLineInfoEx& rCmdInfo)
- {
- for (int i = 0; i < __argc; i++)
- {
- LPCTSTR pszParam = __targv[i];
- rCmdInfo.ParseParam(pszParam);
- }
- }
- void CCommandLineInfoEx::ParseParam(const TCHAR* pszParam)
- {
- if (ParseWindow(pszParam, m_strWindow))
- {
- }
- else if (ParseBatchID(pszParam, m_strBatchID))
- {
- }
- }
- BOOL CCommandLineInfoEx::ParseWindow(string strUrl, string& strWindow)
- {
- const string strKey = "window=";
- int nPos = strUrl.find(strKey);
- if (nPos < 0)
- {
- return FALSE;
- }
- nPos += strKey.length();
- if (nPos >= (int)strUrl.length())
- {
- return FALSE;
- }
- strWindow = strUrl.substr(nPos);
- return TRUE;
- }
- BOOL CCommandLineInfoEx::ParseBatchID(string strUrl, string& strBatchID)
- {
- const string strKey = "batchid=";
- int nPos = strUrl.find(strKey);
- if (nPos < 0)
- {
- return FALSE;
- }
- nPos += strKey.length();
- if (nPos >= (int)strUrl.length())
- {
- return FALSE;
- }
- strBatchID = strUrl.substr(nPos);
- return TRUE;
- }
|