本文整理汇总了C++中CA2T函数的典型用法代码示例。如果您正苦于以下问题:C++ CA2T函数的具体用法?C++ CA2T怎么用?C++ CA2T使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CA2T函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAvatarCache
void GetAvatarCache(LPTSTR szPath)
{
// Получить путь новым способом
if ( ServiceExists( MS_UTILS_REPLACEVARS ) )
{
LPTSTR szAvatarCache = Utils_ReplaceVarsT(
_T("%miranda_avatarcache%\\") modname_t _T("\\") );
if ( szAvatarCache && szAvatarCache != (LPTSTR)0x80000000 )
{
lstrcpyn( szPath, szAvatarCache, MAX_PATH );
// Создание пути до будущего файла аватара
CallService( MS_UTILS_CREATEDIRTREET, 0, (LPARAM)szPath );
return;
}
}
// Получить путь старым способом
char szProfilePath[ MAX_PATH ], szProfileName[ MAX_PATH ];
CallService( MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)szProfilePath );
CallService( MS_DB_GETPROFILENAME, MAX_PATH, (LPARAM)szProfileName );
char *pos = strrchr( szProfileName, '.' );
if ( lstrcmpA( pos, ".dat" ) == 0 )
*pos = 0;
lstrcpy( szPath, CA2T( szProfilePath ) );
lstrcat( szPath, _T("\\") );
lstrcat( szPath, CA2T( szProfileName ) );
lstrcat( szPath, _T("\\AvatarCache\\") modname_t _T("\\") );
// Создание пути до будущего файла аватара
CallService( MS_UTILS_CREATEDIRTREET, 0, (LPARAM)szPath );
return;
}
示例2: CA2T
/*-----------------------------------------------------------------------------
-----------------------------------------------------------------------------*/
int CWsHook::getaddrinfo(PCSTR pNodeName, PCSTR pServiceName, const ADDRINFOA * pHints, PADDRINFOA * ppResult)
{
int ret = WSAEINVAL;
bool overrideDNS = false;
void * context = NULL;
CString name = CA2T(pNodeName);
CAtlArray<DWORD> addresses;
if( dlg )
overrideDNS = dlg->DnsLookupStart( name, context, addresses );
if( _getaddrinfo && !overrideDNS )
ret = _getaddrinfo(CT2A((LPCTSTR)name), pServiceName, pHints, ppResult);
else if( overrideDNS ) {
if( addresses.IsEmpty() )
ret = EAI_NONAME;
else {
// build the response structure with the addresses we looked up
ret = 0;
DWORD count = addresses.GetCount();
ADDRINFOA_ADDR * result = (ADDRINFOA_ADDR *)malloc(sizeof(ADDRINFOA_ADDR) * count);
for (DWORD i = 0; i < count; i++) {
memset( &result[i], 0, sizeof(ADDRINFOA_ADDR) );
result->info.ai_family = AF_INET;
result->info.ai_addrlen = sizeof(struct sockaddr_in);
result->info.ai_addr = (struct sockaddr *)&(result->addr);
result->addr.sin_family = AF_INET;
result->addr.sin_addr.S_un.S_addr = addresses[i];
if( i < count - 1 )
result->info.ai_next = (PADDRINFOA)&result[i+1];
}
addrInfo.AddTail(result);
*ppResult = (PADDRINFOA)result;
}
}
if (!ret && dlg) {
PADDRINFOA addr = *ppResult;
while (addr) {
if (addr->ai_canonname)
dlg->DnsLookupAlias(name, (LPCTSTR)CA2T(addr->ai_canonname));
if (context &&
addr->ai_addrlen >= sizeof(struct sockaddr_in) &&
addr->ai_family == AF_INET) {
struct sockaddr_in * ipName = (struct sockaddr_in *)addr->ai_addr;
dlg->DnsLookupAddress(context, ipName->sin_addr);
}
addr = addr->ai_next;
}
if (context)
dlg->DnsLookupDone(context);
}
return ret;
}
示例3: _tcscpy
BOOL CCommClass::GetLocalIP( TCHAR* chIP, TCHAR* chHostName )
{
BOOL bRet = FALSE;
WORD wVersionRequested;
WSADATA wsaData;
char chName[255];
PHOSTENT hostinfo;
wVersionRequested =MAKEWORD(2,0);
if( WSAStartup( wVersionRequested, &wsaData ) == 0 )
{
if( gethostname(chName,sizeof(chName)) == 0 )
{
if((hostinfo = gethostbyname(chName)) != NULL )
{
LPCSTR ip=inet_ntoa(*(struct in_addr*)*hostinfo->h_addr_list);
_tcscpy( chIP, CA2T(ip) );
if( chHostName != NULL )
_tcscpy( chHostName, CA2T(hostinfo->h_name));
bRet = TRUE;
}
}
WSACleanup();
}
return bRet;
}
示例4: CA2T
// 从XML设置Skin属性
HRESULT CControlBaseFont::OnAttributeSkin(const CStringA& strValue, BOOL bLoading)
{
if (strValue.IsEmpty()) return E_FAIL;
CStringA strSkin = DuiSystem::Instance()->GetSkin(strValue);
if (strSkin.IsEmpty()) return E_FAIL;
if(strSkin.Find(".") != -1) // 加载图片文件
{
CString strImgFile = DuiSystem::GetSkinPath() + CA2T(strSkin, CP_UTF8);
if(strSkin.Find(":") != -1)
{
strImgFile = CA2T(strSkin, CP_UTF8);
}
if(!SetBitmap(strImgFile))
{
return E_FAIL;
}
}else // 加载图片资源
{
UINT nResourceID = atoi(strSkin);
if(!SetBitmap(nResourceID, TEXT("PNG")))
{
if(!SetBitmap(nResourceID, TEXT("BMP")))
{
return E_FAIL;
}
}
}
return bLoading?S_FALSE:S_OK;
}
示例5: Assert
void CZiMainFrame::handlerAddGroupVerify(AddGroupInfo_t *pAddgroup) {
Assert(pAddgroup);
// 显示验证请求框, 交给用户操作.
// 还需要显示请求者的信息, 未实现 ... ???
char szText[1024] = {0};
if (pAddgroup->type == GROUP_INFO_VERIFY) {
sprintf_s(szText, sizeof(szText)/sizeof(szText[0]),
"'%s' 请求加入群 <%s>, 验证信息: '%s'",
pAddgroup->strSenderName.c_str(),
pAddgroup->groupinfo.name.c_str(),
pAddgroup->strVerify.c_str());
CNotifyWindow::MessageBoxX(m_hWnd, _T("验证消息"),
CA2T(szText), _T("同意"), _T("不同意"),
Msg_InAddGroupVerify, pAddgroup);
}
else { //GROUP_INFO_REPLY
//TODO 如果添加者 需要弹框提示
if (IdNetToLocal(Type_ImcFriend, pAddgroup->nSenderId) == m_itemSelfInfo.nId) {
sprintf_s(szText, sizeof(szText)/sizeof(szText[0]),
"加入群 %s %s",
pAddgroup->groupinfo.name.c_str(), (pAddgroup->succ == 0 ? "成功" : "失败"));
CNotifyWindow::MessageBoxX(m_hWnd, _T("通知"),CA2T(szText), 0);
if (pAddgroup->succ == 0) {
//TODO 添加群
ItemNodeInfo_t item;
ItemDataNetToLocal(pAddgroup->groupinfo, item);
AddItem(&item, 0);
//添加成员
CNodeList *pNodeParent = GetNodeInfo(item.nId);
Assert(pNodeParent);
for (size_t i = 0; i < pAddgroup->groupinfo.members.size(); i++) {
ItemNodeInfo_t group_member;
ItemDataNetToLocal(pAddgroup->groupinfo.members[i], group_member, Type_ImcFriendX);
AddItem(&group_member, pNodeParent);
}
}
}
else if (IdNetToLocal(Type_ImcFriend, pAddgroup->nAdminId) != m_itemSelfInfo.nId && pAddgroup->succ == 0) {
CNodeList *pNodeParent = GetNodeInfo(IdNetToLocal(Type_ImcGroup,pAddgroup->groupinfo.group_id));
if (pNodeParent) {
ItemNodeInfo_t item;
ItemDataNetToLocal(pAddgroup->userinfo, item, Type_ImcFriend);
AddItem(&item, pNodeParent);
}
}
m_pMainMsger->FreeDataEx(Msg_ScAddGroupVerify, pAddgroup);
}
}
示例6: GetEntityRegister
//Called when selection in the key-field changes
void CEntityDialogClassInfo::OnLbnSelchangeListKey()
{
int sel = m_lbKey.GetCurSel();
if( sel == LB_ERR )
return;
//Get the selected key
CString selKey;
m_lbKey.GetText( sel, selKey );
//Get the selected class
CString selClass;
m_cbClass.GetLBText( m_cbClass.GetCurSel(), selClass );
//Get the entity-stub from the entity register
CEntityRegisterEntity *pEnt = GetEntityRegister()->GetEntity(selClass);
if( !pEnt )
return;
//Get the value-stub
m_currentKey = pEnt->Get( selKey );
if( !m_currentKey )
return;
//Set help text
m_ecHelp.SetWindowText( CA2T(m_currentKey->desc.c_str()) );
//is an value-edit dialog open? the close!
if( m_activeDialog )
{
m_activeDialog->ShowWindow(SW_HIDE);
RedrawWindow();
}
//Get value-edit dialog for specified value type
auto it = m_valueTypesMap.find(m_currentKey->type);
if( it != m_valueTypesMap.end() )
{
m_activeDialog = it->second;
m_activeDialog->ShowWindow(SW_SHOW);
}
else
m_activeDialog = NULL;
//Get the real value of the entity from the entity.
std::string value = m_editEnt->GetValue( m_currentKey->name );
m_ecValueRaw.SetWindowText( CA2T(value.c_str()) );
}
示例7: DoDataExchange
LRESULT CB2ESelectDialog::OnInitDialog(HWND hWnd, LPARAM lParam)
{
//DDX情報アップデート
DoDataExchange(FALSE);
//---------------
// B2Eの情報取得
//---------------
//B2Eハンドラ
CArchiverB2E &ArcB2E=CArchiverDLLManager::GetInstance().GetB2EHandler();
ASSERT(ArcB2E.IsOK()); //B2Eが使えない時は呼ばないように!
if(!ArcB2E.IsOK())return FALSE;
//B2E情報取得
if(!ArcB2E.EnumCompressB2EScript(m_ScriptInfoArray))m_ScriptInfoArray.clear();
//使えるB2Eがあれば
if(!m_ScriptInfoArray.empty()) {
//---形式
UINT uIdx=0;
for(; uIdx<m_ScriptInfoArray.size(); uIdx++) {
Combo_Format.AddString(CA2T(m_ScriptInfoArray[uIdx].szFormat));
}
::EnableWindow(GetDlgItem(IDC_CHECK_COMPRESS_SFX),m_ScriptInfoArray[0].wAbility&B2EABILITY_SFX);
Combo_Format.SetCurSel(0);
//---メソッド
if(m_ScriptInfoArray[0].MethodArray.empty()) {
Combo_Method.AddString(_T("Default"));
}
else {
for(uIdx=0; uIdx<m_ScriptInfoArray[0].MethodArray.size(); uIdx++) {
Combo_Method.AddString(CA2T(m_ScriptInfoArray[0].MethodArray[uIdx]));
}
}
Combo_Method.SetCurSel(m_ScriptInfoArray[0].nDefaultMethod);
}
else {
::EnableWindow(GetDlgItem(IDC_CHECK_COMPRESS_SFX),false);
::EnableWindow(GetDlgItem(IDC_CHECK_SINGLE_COMPRESSION),false);
Combo_Format.EnableWindow(false);
Combo_Method.EnableWindow(false);
::EnableWindow(GetDlgItem(IDOK),false);
}
CenterWindow();
return TRUE;
}
示例8: LOG_WS_FUNCTION_SCOPE
void WordSchemaSoftDiscoverStrategy::ExtractNoteData(const WrdNote& note, TextTypeEnums textType)
{
LOG_WS_FUNCTION_SCOPE();
WrdText text;
ChUINT4 count = note.getNoteTextLength();
text.setTextType(textType);
text.getTextReference().setMinimumCapacity(2 * count);
text.getTextReference().setStartCP(note.getStartCPOfNoteText());
text.getTextReference().setCharacterCount(count);
m_pReader->read(text);
USES_CONVERSION;
std::tstring sBuffer;
if(2 == text.getTextReference().getCharacterSize())
{
const wchar_t* wchars = (const wchar_t*)text.getText().getBuffer();
sBuffer = std::tstring( CW2T( wchars ) );
}
else
{
const char* chars = (const char*)text.getText().getBuffer();
sBuffer = std::tstring( CA2T( chars ) );
}
if(sBuffer.length() > 0) // OnFootnote called in same scope as CW2T to avoid auto destruction of szBuffer
m_pVisitor->OnFootnote(sBuffer);
}
示例9: CT2A
//Called when selection inside the combobox has changed
void CEntityDialogClassInfo::OnCbnSelchangeCbClass()
{
m_lbKey.ResetContent();
//Get current selected class name
std::string classname;
CString selection;
int sel = m_cbClass.GetCurSel();
if( sel == CB_ERR )
return;
m_cbClass.GetLBText( m_cbClass.GetCurSel(), selection );
classname = CT2A(selection);
CEntityRegisterEntity *pEnt = GetEntityRegister()->GetEntity(classname);
if( !pEnt )
return;
for( int i = 0; i < pEnt->size(); i++ )
{
m_lbKey.AddString( CA2T( pEnt->Get(i)->name.c_str() ) );
}
//select first index in key list
m_lbKey.SetCurSel(0);
OnLbnSelchangeListKey();
}
示例10: LoadSubMenu
// 加载指定名字的菜单节点
BOOL CDuiMenu::LoadSubMenu(TiXmlElement* pXmlElem, CString strSubItemName)
{
if(pXmlElem == NULL)
{
return FALSE;
}
// 递归遍历下层节点,看是否有指定名字的节点
TiXmlElement* pItemElem = NULL;
for (pItemElem = pXmlElem->FirstChildElement(); pItemElem != NULL; pItemElem=pItemElem->NextSiblingElement())
{
CStringA strNameA = pItemElem->Attribute("name");
if(strSubItemName == CA2T(strNameA, CP_UTF8))
{
// 加载子菜单
return Load(pItemElem);
}
if(LoadSubMenu(pItemElem, strSubItemName))
{
// 如果递归加载成功则返回,否则继续向下遍历查找
return TRUE;
}
}
return FALSE;
}
示例11: CA2T
CString CHTMLayoutCtrl::GetElementType(HELEMENT he)
{
htmlayout::dom::element el = he;
USES_CONVERSION;
CString s = CA2T(el.get_element_type());
return s;
}
示例12: _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);
}
示例13: m_pNPStream
CPlugin::CPlugin(const nsPluginCreateData& data)
:m_pNPInstance(data.instance),
m_pNPStream(NULL),
m_bInitialized(false),
m_pScriptableObject(NULL),
m_pIEHostWindow(NULL),
m_pWindow(NULL),
m_pContainer(NULL)
{
// <html:embed id='fireie-utils-object' type='application/fireie' hidden='true' width='0' height='0'/>
// argc == 5
// argn[0] = "id", argn[1] = "type", argn[2] = "hidden", argn[3] = "width", argn[4] = "height"
// argn[0] = "fireie-utils-object", argn[1] = "application/fireie", argn[2] = "true", argn[3]="0", argn[4]="0"
// Get Plugin ID
int i = 0;
for (i=0; i<data.argc; i++)
{
if (_stricmp(data.argn[i], "id") == 0)
{
break;
}
}
if (i < data.argc)
{
m_strId = CA2T(data.argv[i]);
}
}
示例14: ShouldLoadActivationContext
void ActivationContextLoader::Initialise(const CStdString& sManifest)
{
if (CGeneral::FileExists(sManifest))
{
m_sManifest = sManifest;
}
else
{
CPath path;
path.Combine(GetModulePath(), sManifest);
m_sManifest = path;
}
try
{
// Don't do anything if we're not at least running on xp
m_bShouldLoadActivationContext = ShouldLoadActivationContext();
if (m_bShouldLoadActivationContext)
{
LoadDll();
if (!IsActivationContextAlreadyActiveForManifest())
{
LoadAC();
}
}
}
catch (std::exception & e)
{
CStdString sError = CA2T(e.what());
LOG_WS_ERROR(sError);
}
}
示例15: GetCurrentDirectory
int CTwain::OpenSource(LPCSTR pzSourceName)
{
if (nState != SOURCE_MANAGER_OPEN) return FALSE;
BOOL bFound = FALSE;
// Prevent TWAIN (or some DS?) from clobbering the current dir.
// Per David Offen 3/7/00
TCHAR szDir[_MAX_PATH];
GetCurrentDirectory(_MAX_PATH, szDir);
// Look for matching DS
unsigned uMsg = MSG_GETFIRST;
while (memset(&SourceId, 0, sizeof SourceId) &&
SM(DG_CONTROL, DAT_IDENTITY, uMsg, &SourceId)) {
if (_stricmp(SourceId.ProductName, pzSourceName) == 0) {
// bingo
bFound = TRUE;
break;
}
uMsg = MSG_GETNEXT;
} // while
if (bFound) {
SM(DG_CONTROL, DAT_IDENTITY, MSG_OPENDS, &SourceId);
if (nState != SOURCE_OPEN && bTrace) ATLTRACE(_T("TWAIN:OPENDS failed.\n"));
} else if (bTrace) {
USES_CONVERSION;
ATLTRACE(_T("CTwain::OpenSource - source named '%s' not found.\n"), CA2T(pzSourceName));
}
SetCurrentDirectory(szDir);
return (nState == SOURCE_OPEN);
} // OpenSource