怎么样处理获得的字符串?
怎么把参数从里面提取出来?
有什么好的方法么?

解决方案 »

  1.   

    有个类CCommandLineInfo是专门定义用来处理命令行参数解析的。
      

  2.   

    LPTSTR GetCommandLine( );
    Return Values
    The return value is a pointer to the command-line string for the current process. 
      

  3.   

    TCHAR   lpszBuff[256];
            LPTSTR  lpszStr = lpszBuff +128;        LPTSTR  lpszName        = lpszBuff;
            HANDLE  hKey            = NULL;
            DWORD   dwStrCb         = 0;
            DWORD   dwValueType     = 0;
            // Get service name currently
            lpszName = GetCommandLine();
            for( int i = _tcslen(lpszName)-1; i>=0; i-- )
            {
                    if( ( lpszName[i] != '"' )&&( lpszName[i]!=' ') )
                            break;
                    else if( lpszName[i] == '"' )
                            lpszName[i] = '\0';
            }
            if( lpszName[0] == '"' )
                    lpszName = lpszName +1;