📄 commandline.h
字号:
#ifndef CommandLine_H_2004_11_27_
#define CommandLine_H_2004_11_27_
class CCmdLine
{
public:
LPSTR TrimQuot(LPCTSTR lpszText);
CCmdLine(LPCTSTR lpszCommandLine=NULL);
~CCmdLine()
{
delete [] m_pszCommandLine;
}
LPSTR GetAt(const int index) {return item[index];}
DWORD GetCount() {return m_nCount;}
LPSTR Find(LPCTSTR lpszFind,const unsigned int nStart=0);
LPSTR GetCommandLine(){ return ::GetCommandLine();}
private:
char m_szBuf[255];
DWORD m_nCount;
char * item[100];
char * m_pszCommandLine;
};
CCmdLine::CCmdLine(LPCTSTR lpszCommandLine)
{
m_szBuf[0]=0;
if (lpszCommandLine==0)
lpszCommandLine=GetCommandLine();
m_pszCommandLine=new char[lstrlen(lpszCommandLine)+1];
char e;
m_nCount=0;
int n=0;
while (*lpszCommandLine)
{
if (*lpszCommandLine=='"')
{
e='"';
lpszCommandLine++;
}
else
{
e=' ';
}
item[m_nCount++]=&m_pszCommandLine[n];
while (*lpszCommandLine!=e && *lpszCommandLine)
{
m_pszCommandLine[n++]=*lpszCommandLine++;
}
m_pszCommandLine[n++]=0;
if (*lpszCommandLine==0) break;
if (e=='"') if (*++lpszCommandLine==0) break;
if (*++lpszCommandLine==0) break;
}
}
LPSTR CCmdLine::Find(LPCTSTR lpszFind,const unsigned int nStart/* =0 */)
{
for (unsigned int i=nStart;i<m_nCount;i++)
{
if (strstr(item[i],lpszFind))
return item[i]+lstrlen(lpszFind);
}
return 0;
}
LPSTR CCmdLine::TrimQuot(LPCTSTR lpszText)
{
size_t n=lstrlen(lstrcpy(m_szBuf,lpszText));
if (m_szBuf[n-1]=='"') m_szBuf[n-1]=0;
return m_szBuf[0]=='"'?&m_szBuf[1]:m_szBuf;
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -