当前位置: 首页>>代码示例>>C++>>正文


C++ CT2A函数代码示例

本文整理汇总了C++中CT2A函数的典型用法代码示例。如果您正苦于以下问题:C++ CT2A函数的具体用法?C++ CT2A怎么用?C++ CT2A使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CT2A函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _snprintf

void NS_ISERVER::CLocalServer::LocalAuditUserQuit(CString strTermID, CString strIP,UINT nMemberID)
{
	NET_HEAD_MAN head = {0};
	head.Version = COM_VER;
	head.Length = sizeof TIBAAuditUserQuit;
	head.Cmd = C_MANGER_AUDITUSERQUIT;

	TIBAAuditUserQuit info = {0};

	_snprintf(info.termID, LEN_TERMID, CT2A(strTermID));
	_snprintf(info.termIP, LEN_IPADDR, CT2A(strIP));
	info.memberID=nMemberID;

	CByteArray buffer;
	buffer.SetSize(sizeof NET_HEAD_MAN + head.Length);

	memcpy(buffer.GetData(), &head, sizeof NET_HEAD_MAN);
	memcpy(buffer.GetData() + sizeof NET_HEAD_MAN, &info, sizeof TIBAAuditUserQuit);

	m_lpSocket->SendBuffer(buffer.GetData(), buffer.GetSize());

	buffer.RemoveAll();

	IBA_LOG(_T("发送实名下机信息,TermID=%s,IP=%s,MemberID=%d"),strTermID,strIP,nMemberID);
}
开发者ID:layerfsd,项目名称:PersonalIBA,代码行数:25,代码来源:LocalServer.cpp

示例2: _T

	void CPlugin::SetFirefoxCookie(const vector<SetFirefoxCookieParams>& vCookies, ULONG_PTR ulWindowId)
	{
		CString strEventType = _T("IEBatchSetCookie");
		CString strDetail;
		Json::Value json;
		Json::Value aCookies;
		for (size_t i = 0; i < vCookies.size(); i++)
		{
			const SetFirefoxCookieParams& param = vCookies[i];
			Json::Value cookie;
			cookie["url"] = (LPCSTR)CT2A(param.strURL, CP_UTF8);
			cookie["header"] = (LPCSTR)CT2A(param.strCookie, CP_UTF8);
			aCookies.append(cookie);
		}
		json["cookies"] = aCookies;

		if (ulWindowId)
		{
			char szWindowId[32] = { 0 };
			_ui64toa_s(ulWindowId, szWindowId, 32, 10);
			json["windowId"] = szWindowId;
		}

		strDetail = CA2T(json.toStyledString().c_str(), CP_UTF8);
		FireEvent(strEventType, strDetail);
	}
开发者ID:cha63501,项目名称:Fire-IE,代码行数:26,代码来源:plugin.cpp

示例3: memcpy

BOOL __stdcall ComDlgHistoryLog::EnumValue( LPCTSTR value_name, ULONG value_type, UCHAR* value, ULONG value_size, PVOID context )
{
    Json::Value *log_value = (Json::Value *)context;
    if (value_type == REG_BINARY) {
        if (_tcscmp(TEXT("MRUListEx"), value_name) != 0) {
            LPITEMIDLIST file_pidl = (LPITEMIDLIST)CoTaskMemAlloc(sizeof(UCHAR) + value_size);

            if (file_pidl) {
                memcpy(file_pidl, value, value_size);
                WCHAR mru_file_path[MAX_PATH] = { 0 };
                if (SHGetPathFromIDList(file_pidl, mru_file_path)) {
                    Json::Value item;
                    item["path"] = CT2A(mru_file_path).m_psz;
                    log_value->append(item);
                }
                CoTaskMemFree(file_pidl);
            }
        }
    }
    else if (value_type == REG_SZ) {
        if (_tcscmp(TEXT("MRUList"), value_name) != 0) {
            PWSTR mru_file_path = (PWSTR)value;
            Json::Value item;
            item["path"] = CT2A(mru_file_path).m_psz;
            log_value->append(item);
        }
    }
    
    return TRUE;
}
开发者ID:0cch,项目名称:misc,代码行数:30,代码来源:SecurityCheck.cpp

示例4: switch

bool CWordBinaryMetadataDiscoveryWorker::PopulatePropertyLists(CWordBinaryMetadataDiscoveryWorker::WordPropertyTypes WordPropertyType, CStdString& sPropertyName, CStdString& sPropertyValue)
{
	USES_CONVERSION;
	switch(WordPropertyType)
	{
		case BUILT_IN_PROPERTY:
			if(sPropertyName.IsEmpty())
				return true;
			
			if (c_sHyperLinkBasePropertyName == std::string(CT2A(sPropertyName.c_str())) )
				sPropertyName = _T("Hyperlink base");
			else if (c_sHyperLinksPropertyName == std::string(CT2A(sPropertyName.c_str())) )
				return true;
			
			m_BuiltInPropertiesMap.insert(PropertyMapType::value_type(sPropertyName, sPropertyValue));
			m_lBuiltInPropertyCount++;
			break;

		case CUSTOM_PROPERTY:
			m_CustomPropertiesMap.insert(PropertyMapType::value_type(sPropertyName, sPropertyValue));
			m_lCustomPropertyCount++;
			break;

		case DOCUMENT_STATISTIC:
			m_DocumentStatisticsMap.insert(PropertyMapType::value_type(sPropertyName, sPropertyValue));
			m_lDocumentStatisticsCount++;
			break;

		default:
			LOG_WS_ERROR(_T("Unknown WordPropertyTypes passed as parameter"));
			return false;
	}
	return true;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:34,代码来源:WordBinaryMetadataDiscoveryWorker.cpp

示例5: TRACE

BOOL CXMLElement::Merge(const CXMLElement* pInput, BOOL bOverwrite)
{
	if ( ! this || ! pInput ) return FALSE;
	if ( this == pInput ) return TRUE;

	TRACE( "Merging   XML: %s\n", (LPCSTR)CT2A( ToString( FALSE, FALSE ) ) );
	TRACE( "      and XML: %s\n", (LPCSTR)CT2A( pInput->ToString( FALSE, FALSE ) ) );

	if ( m_sName.CompareNoCase( pInput->m_sName ) != 0 )
	{
		TRACE( "Failed to merge XML due different schemes \"%s\" and \"%s\".\n", (LPCSTR)CT2A( m_sName ), (LPCSTR)CT2A( pInput->m_sName ) );
		return FALSE;
	}

	BOOL bChanged = FALSE;

	for ( POSITION pos = pInput->GetElementIterator(); pos; )
	{
		const CXMLElement* pElement = pInput->GetNextElement( pos );
		CXMLElement* pTarget = GetElementByName( pElement->m_sName );

		if ( pTarget == NULL )
		{
			AddElement( pElement->Clone() );
			bChanged = TRUE;
		}
		else if ( pTarget->Merge( pElement, bOverwrite ) )
		{
			bChanged = TRUE;
		}
	}

	for ( POSITION pos = pInput->GetAttributeIterator(); pos; )
	{
		CXMLAttribute* pAttribute = pInput->GetNextAttribute( pos );
		CXMLAttribute* pTarget = GetAttribute( pAttribute->m_sName );

		if ( pTarget == NULL )
		{
			AddAttribute( pAttribute->Clone() );
			bChanged = TRUE;
		}
		else if ( bOverwrite && ! pTarget->Equals( pAttribute ) )
		{
			pTarget->SetValue( pAttribute->GetValue() );
			bChanged = TRUE;
		}
	}

	if ( bChanged )
		TRACE( "resulting XML: %s\n", (LPCSTR)CT2A( ToString( FALSE, FALSE ) ) );
	else
		TRACE( "resulting XML unchanged.\n" );

	return bChanged;
}
开发者ID:GetEnvy,项目名称:Envy,代码行数:56,代码来源:XML.cpp

示例6: min

void Rectan::Save(ofstream& out)
{
	int x = min(m_x1, m_x2);
	int y = min(m_y1, m_y2);
	int width = abs(m_x1 - m_x2);
	int height = abs(m_y1 - m_y2);
	CString temp;
	temp.Format(_T(" fill=\"rgb(%d, %d, %d)\""), m_Background_Color.GetRed(), m_Background_Color.GetGreen(), m_Background_Color.GetBlue());
	out << "<rect x=\"" << x << "\" y=\"" << y << "\" width=\"" << width << "\" height=\"" << height << "\"";
	out << CT2A(temp);
	temp.Format(_T(" stroke=\"rgb(%d, %d, %d)\""), m_Color.GetRed(), m_Color.GetGreen(), m_Color.GetBlue());
	out << CT2A(temp);
	out << " stroke-width=\"" << m_Width << "\" />";
}
开发者ID:dtien147,项目名称:Paint2,代码行数:14,代码来源:Rectangle.cpp

示例7: if

/*-----------------------------------------------------------------------------
-----------------------------------------------------------------------------*/
bool CWinInetEvents::RegexMatch(CString str, CString regex) {
  bool matched = false;

  if (str.GetLength()) {
    if (!regex.GetLength() || !regex.Compare(_T("*")) || !str.CompareNoCase(regex)) {
      matched = true;
    } else if (regex.GetLength()) {
        std::tr1::regex match_regex(CT2A(regex), std::tr1::regex_constants::icase | std::tr1::regex_constants::ECMAScript);
        matched = std::tr1::regex_match((LPCSTR)CT2A(str), match_regex);
    }
  }

  return matched;
}
开发者ID:Trott,项目名称:webpagetest,代码行数:16,代码来源:WinInetEvents.cpp

示例8: _tmain

int _tmain(int argc, _TCHAR* argv[])
{
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);

	IODispatcher ioService(GetFitThreadNum());
	

	try
	{
		std::string ip;
		if( argc > 1 )
			ip = CT2A(argv[1]);
		else
			ip = "127.0.0.1";

		std::vector<Client *> clis;
		size_t cnt = 1;
		if( argc > 2 )
			cnt = _tstoi(argv[2]);

		clis.resize(cnt);
		for(size_t i = 0; i != cnt; ++i)
			clis.push_back(new Client(ioService, ip.c_str(), 5050));


		system("pause");
	}
	catch(std::exception &e)
	{
		std::cout << e.what() << std::endl;
	}
	
	return 0;
}
开发者ID:wang1986one,项目名称:iocpframework,代码行数:34,代码来源:NetworkCli.cpp

示例9: UpdateData

void CVNOCLoginDlg::OnBnClickedOk()
{
    UpdateData(TRUE);
	Global->Logf(LogFile_Net,_T("登陆操作,用户名:%s 密码:%s\n"), m_strUsername, m_strPassword);
	if (m_strUsername.IsEmpty())
	{
		OnOK();
	}

	SHA1 shaer;
	shaer.Reset();

	CStringA pwdBuffer = CT2A(m_strPassword);
	shaer.Input(pwdBuffer,pwdBuffer.GetLength());
	UINT pResult[5];
	shaer.Result(pResult);
	pwdBuffer.Format("%08x%08x%08x%08x%08x"
		,pResult[0],pResult[1],pResult[2],pResult[3],pResult[4]);
	Global->Logf(LogFile_General,_T("SHA1后的密码为:%s\n"),CA2T(pwdBuffer));

	INetCenter *pInet=NULL;
	Global->GetINetCenter(&pInet);
	ATLASSERT(pInet);
	if (pInet)
	{
		MSG_RLI mRli;
		mRli.SetAccountNumber((byte*)(LPCTSTR)m_strUsername,m_strUsername.GetLength()*sizeof(TCHAR));
		mRli.SetPassword((byte*)(LPCSTR)pwdBuffer,pwdBuffer.GetLength()*sizeof(TCHAR));
		pInet->SendServer(mRli);

		_SetVerifyState(TRUE);
		SetTimer(0,5000,NULL);
	}
}
开发者ID:AngryPowman,项目名称:vnoc,代码行数:34,代码来源:VNOCLoginDlg.cpp

示例10: pLock

CTransferFile* CTransferFiles::Open(LPCTSTR pszFile, BOOL bWrite)
{
	CSingleLock pLock( &m_pSection, TRUE );

	CTransferFile* pFile = NULL;
	if ( m_pMap.Lookup( pszFile, pFile ) )
	{
		if ( bWrite && ! pFile->EnsureWrite() )
			return NULL;
	
		pFile->AddRef();
	}
	else
	{
		pFile = new CTransferFile( pszFile );
		if ( ! pFile->Open( bWrite ) )
		{
			DWORD dwError = GetLastError();
			pFile->Release();
			SetLastError( dwError );
			return NULL;
		}

		m_pMap.SetAt( pFile->m_sPath, pFile );

		TRACE( "Transfer Files : Opened \"%s\" [%s]\n", (LPCSTR)CT2A( pszFile ), ( bWrite ? "write" : "read" ) );
	}

	return pFile;
}
开发者ID:ivan386,项目名称:Shareaza,代码行数:30,代码来源:TransferFile.cpp

示例11: Restore

 void Restore(IPersistable * window) const
 {
     clib::recursive_mutex::scoped_lock lock(m_mutex);
     WINDOWPLACEMENT placement;
     std::string encodedStr = CT2A(m_props.Get(PERSIST_PLACEMENT));
     int decodedLen = sizeof(WINDOWPLACEMENT);
     BOOL hr = Base64Decode(encodedStr.c_str(), encodedStr.length(), reinterpret_cast<BYTE *>(&placement), &decodedLen);
     if (hr && placement.length == sizeof(WINDOWPLACEMENT))
     {
         if (placement.showCmd == SW_SHOWMINIMIZED)
         {
             //(Prevent Launch To Minimized)
             placement.showCmd = SW_SHOWNORMAL;
         }
         RECT rMaxWA;
         ::SystemParametersInfo(SPI_GETWORKAREA, 0, &rMaxWA, 0);
         if( (placement.rcNormalPosition.left >= rMaxWA.left) &&
             (placement.rcNormalPosition.top >= rMaxWA.top) &&
             (placement.rcNormalPosition.right <= rMaxWA.right) &&
             (placement.rcNormalPosition.bottom <= rMaxWA.bottom) )
         {
             // If All Values Within The Visible Screen (Taking Into Account Only The Primary Monitor...!), Set The Placement
             ::SetWindowPlacement(window->GetHwnd(), &placement);
         }
     }
     window->RestorePersistInfo(m_props);
 }
开发者ID:dehilsterlexis,项目名称:eclide-1,代码行数:27,代码来源:WorkspaceItem.cpp

示例12: SetIcon

BOOL CCPPhDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	// TODO: Add extra initialization here
	
	this->flog.open(_T("cpph.log")); //open log

	SetTimer(1, 1000, 0); //timer to show minutes to close

	//established token
	this->established_token_status = this->token.establish_token();
	TCHAR msg_char[200];
	if (this->established_token_status == 0){
		this->token.list_containers(this->token_containeres);
		if (this->cur_container_name != this->token_containeres[this->cur_container_id]){ //if not displayed, show it
			wsprintf(msg_char, _T("%s \"%S\""), STATIC_TEXT_1, this->token_containeres[this->cur_container_id].c_str());
			mMsg.SetWindowTextW(msg_char);
			this->cur_container_name = this->token_containeres[this->cur_container_id];
			this->flog << this->loctime() << ": Established container: " << this->cur_container_name << endl; //log
		}
	}
	
	TCHAR l[100];
	GetKeyboardLayoutName(l);
	this->flog << this->loctime() << ": Current leyboard layout: " << CT2A(l) << endl;

	return TRUE;  // return TRUE  unless you set the focus to a control
}
开发者ID:12019,项目名称:Antitoken,代码行数:34,代码来源:CPPhDlg.cpp

示例13: db

void CThumbCache::InitDatabase()
{
	auto_ptr< CDatabase > db( theApp.GetDatabase( DB_THUMBS ) );
	if ( ! *db )
	{
		TRACE( "CThumbCache::InitDatabase : Database error: %s\n", (LPCSTR)CT2A( db->GetLastErrorMessage() ) );
		return;
	}

	// Recreate table
	if ( ! db->Exec( L"CREATE TABLE Files ("
			 L"Filename TEXT UNIQUE NOT NULL PRIMARY KEY, "
			 L"FileSize INTEGER NOT NULL, "
			 L"LastWriteTime INTEGER NOT NULL, "
			 L"Image BLOB NOT NULL, "	// as JPEG
			 L"Flags INTEGER DEFAULT 0 NULL, "
			 L"SHA1 TEXT NULL, TTH TEXT NULL, ED2K TEXT NULL, MD5 TEXT NULL); "
			 L"CREATE INDEX IDX_SHA1 ON Files(SHA1 ASC); "
			 L"CREATE INDEX IDX_TTH ON Files(TTH ASC); "
			 L"CREATE INDEX IDX_ED2K ON Files(ED2K ASC); "
			 L"CREATE INDEX IDX_MD5 ON Files(MD5 ASC);" ) )
	{
		// Cleanup existing
		//TIMER_START
		theApp.KeepAlive();
		db->Exec( L"PRAGMA synchronous=OFF" );		// Async return (15% faster, ~1sec)
		db->Exec( L"PRAGMA journal_mode=OFF" );		// No temp "-journal" rollback file created (2X time)
		db->Exec( L"VACUUM;" );						// Several seconds if large
		theApp.KeepAlive();
		//TIMER_STOP
	}
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:32,代码来源:ThumbCache.cpp

示例14: IsIPAddress

BOOL IsIPAddress(LPCTSTR lpszAddress)
{
	if(!lpszAddress || lpszAddress[0] == '\0')
		return FALSE;

	return ::inet_addr(CT2A(lpszAddress)) != INADDR_NONE;
}
开发者ID:407390911,项目名称:HP-Socket,代码行数:7,代码来源:SocketHelper.cpp

示例15: CodePassword

CString CodePassword(LPCTSTR decrypted)
{
	CString crypted;
	char cDecrypted[256] = { 0 };
	strcpy(cDecrypted, CT2A(decrypted));
	char *p = cDecrypted;
	while (*p != '\0')
	{
		for (int i = 0; i < 256; i++)
		{
			if (*p == CodeBook[i])
			{
				TCHAR code[3] = {0};
				wsprintf((LPWSTR)code, _T("%02x"), i);
				crypted.AppendChar(code[0]);
				crypted.AppendChar(code[1]);
				break;
			}
		}

		p++;
	}

	return crypted;
}
开发者ID:Echo-M,项目名称:producingManagementAK47,代码行数:25,代码来源:working_parameters.cpp


注:本文中的CT2A函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。