61 lines
1.5 KiB
C++
61 lines
1.5 KiB
C++
|
|
#include "StdAfx.h"
|
|||
|
|
#include "WHCommandLine.h"
|
|||
|
|
|
|||
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>캯<EFBFBD><ECBAAF>
|
|||
|
|
CWHCommandLine::CWHCommandLine()
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CWHCommandLine::~CWHCommandLine()
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
|
|||
|
|
bool CWHCommandLine::SearchCommandItem(LPCTSTR pszCommandLine, LPCTSTR pszCommand, TCHAR szParameter[], WORD wParameterLen)
|
|||
|
|
{
|
|||
|
|
//Ч<><D0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
ASSERT((pszCommandLine!=NULL)&&(pszCommand!=NULL));
|
|||
|
|
if ((pszCommandLine==NULL)||(pszCommand==NULL)) return false;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
if (pszCommandLine[0]!=0)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
UINT nCommandLen=lstrlen(pszCommand);
|
|||
|
|
LPCTSTR lpszBeginString=pszCommandLine;
|
|||
|
|
|
|||
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
|
while (true)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
LPCTSTR lpszEndString=_tcschr(lpszBeginString,TEXT(' '));
|
|||
|
|
UINT nStringLength=(lpszEndString==NULL)?lstrlen(lpszBeginString):(UINT)(lpszEndString-lpszBeginString);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
if ((nStringLength>=nCommandLen)&&(memcmp(lpszBeginString,pszCommand,nCommandLen*sizeof(TCHAR))==0))
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>
|
|||
|
|
ASSERT(wParameterLen>(nStringLength-nCommandLen));
|
|||
|
|
if ((wParameterLen<=(nStringLength-nCommandLen))) return false;
|
|||
|
|
|
|||
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
|
szParameter[nStringLength-nCommandLen]=0;
|
|||
|
|
CopyMemory(szParameter,lpszBeginString+nCommandLen,(nStringLength-nCommandLen)*sizeof(TCHAR));
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>
|
|||
|
|
if (lpszEndString==NULL) break;
|
|||
|
|
lpszBeginString=(lpszEndString+1);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//////////////////////////////////////////////////////////////////////////////////
|