|
通过支持AT指令集的手机发送短消息(源代码)(10) if( pFirst != NULL ) { pNext = strchr( pFirst, '\n' ); if( pNext != NULL ) { int len = pNext - pFirst; if( len <= 0 ) continue; char szCmd[30] = {0}; memcpy( szCmd, "AT+CMGD=", 8 ); memcpy( szCmd + 8, pFirst, len ); szCmd[8+len] = '\r'; Submit( szCmd, len + 9 ); } } pNext = strstr( szBuffer, "+CMGR:" ); if( pNext != NULL ) { pFirst = strchr( pNext, '\n' ); while( pFirst[0] == '\r' pFirst[0] == '\n' ) pFirst ++; if( pFirst != NULL ) { pNext = strchr( pFirst, '\r' ); if( pNext != NULL ) { pNext[0] = '\0'; DWORD dwWaitRet = WaitForMultipleObjects( m_dwSMContentPoolNum, m_phSMPIDLE, FALSE, 1000 ); if( dwWaitRet != WAIT_TIMEOUT ) { DWORD dwMsgLen = strlen( pFirst ); m_pSMPool[dwWaitRet].pData = new char[dwMsgLen]; CopyMemory( m_pSMPool[dwWaitRet].pData, pFirst, dwMsgLen ); m_pSMPool[dwWaitRet].dwSize = dwMsgLen; SetEvent( m_pSMPool[dwWaitRet].hSMPHaveData );
|