• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ atl::CString类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: RegisterComDLL

	bool RegisterComDLL(HINSTANCE hin,LPCTSTR dll)
	{
		TCHAR curpath[MAX_PATH];
		GetModuleFileName( hin, curpath, MAX_PATH );
		PathRemoveFileSpec(curpath);
		ATL::CString file;
		file += "regsvr32 \"";
		file += curpath;
		file += "\\";
		file += dll;
		file += "\" /s";
		STARTUPINFO si={0};
		si.cb = sizeof(si);
		PROCESS_INFORMATION pi={0};
		if(!CreateProcess( NULL,(LPWSTR)file.GetString(),  NULL,NULL,FALSE,0, NULL,NULL,&si, &pi ))
		{
			DebugOutF(filelog::log_error,"CreateProcess failed with %d",GetLastError() );
			return false;
		}
		WaitForSingleObject(pi.hProcess,-1);
		DWORD exitcode = 0;
		GetExitCodeProcess(pi.hProcess,&exitcode);
		if(pi.hProcess)CloseHandle(pi.hProcess);
		if(pi.hThread)CloseHandle(pi.hThread);
		return exitcode == 0;
	}
开发者ID:Nillouise,项目名称:WinRobot,代码行数:26,代码来源:WinRobotHost.cpp


示例2: InitPlugins

 ///process based init
 /// todo - destructor order(I am not sure if it is correct!!)
 bool PluginMng::InitPlugins(){
   if (plugins_.empty()){
     LoadPlugins();
     uuiterator vb=plugins_.begin(),ve=plugins_.end();
     for (uuiterator i=vb;i!=ve;++i){
       uuplugin* p= *i;
       CRegKey crk;
       long rk=crk.Open(HKEY_LOCAL_MACHINE, _6bees_const::kplugindisabled, KEY_READ|KEY_WRITE);
       if (rk==ERROR_SUCCESS){
         DWORD i=0;
         ATL::CString menuid;
         menuid.Format(_T("%d"),p->menuwID_);
         if (crk.QueryDWORDValue(menuid,i)==ERROR_SUCCESS){
           p->enabled_ = false;
         }
       }
       if (p->enabled_){
         p->init();
       }else{
         disabled_plugins_.push_back(p);
       }
     }
     fillpartswidth();
   }
   return true;
 }
开发者ID:henrywoo,项目名称:ultraie,代码行数:28,代码来源:pluginmng.cpp


示例3: readInt

int CSetProxServer::readInt(ATL::CString str)
{
	int nValue = 0;
// 	if (str.Compare(PROX_SERVER_TYPE_IE) == 0)
// 	{
// 		nValue = 1;
// 	}
	if (str.Compare(PROX_SERVER_TYPE_NONE) == 0)
	{
		nValue = 0;
	}
	else if (str.Compare(PROX_SERVER_TYPE_HTTP) == 0)
	{
		nValue = 1;
	}
	else if (str.Compare(PROX_SERVER_TYPE_SOCK) == 0)
	{
		nValue = 2;
	}
	else if (str.Compare(PROX_SERVER_VERIFY_NO) == 0)//验证过程
	{
		nValue = 0;
	}
	else if (str.Compare(PROX_SERVER_VERIFY_YES) == 0)
	{
		nValue = 1;
	}	
	else
	{
		nValue = -1;
	}
	return nValue;
}
开发者ID:dreamsxin,项目名称:PcManager,代码行数:33,代码来源:setProxServer.cpp


示例4: OnHBarSearchPrev

LRESULT CH_HBarWnd::OnHBarSearchPrev(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL& bHandled){
  if(newpage){
    return 0;
  }
  CComBSTR search_words = NULL;
  m_BandEditCtrl.GetWindowText(&search_words);
  ATL::CString sw = search_words.m_str;
  if(sw.IsEmpty()){
    return 0;
  }
  newpage = FALSE;
  if(currentRange2==NULL){
    CComQIPtr<IHTMLBodyElement,&IID_IHTMLBodyElement> bodyElement(body);
    if(FAILED(bodyElement->createTextRange(&currentRange2)) && currentRange2==NULL){return 0;}
  }
  VARIANT_BOOL bSuccess;
  long t=0;
  if(wParam == HBAR_SEARCHPREVFAILED && lParam==HBAR_SEARCHPREVFAILED){//at the beginning
    CComQIPtr<IHTMLBodyElement,&IID_IHTMLBodyElement> bodyElement(body);
    if(FAILED(bodyElement->createTextRange(&currentRange2)) && currentRange2==NULL){return 0;}
  }else{
    currentRange2->setEndPoint(_T("EndToStart"),currentRange);
    currentRange2->moveEnd(_T("Character"),-1*search_words.Length(),&t);
  }
  DWORD flag = (m_case.GetCheck()==BST_UNCHECKED?0:FINDTEXT_MATCHCASE);
  if(currentRange2!=NULL && SUCCEEDED(currentRange2->findText(search_words,-1,flag,&bSuccess)) && bSuccess==VARIANT_TRUE){
    int a=0;
    if(FAILED(currentRange2->select())){a=1;}
    currentRange->setEndPoint(_T("StartToEnd"),currentRange2);
    if(a==1){::PostMessage(m_hWnd, WM_HBAR_SEARCH_PREV, 0, 0);}
  }else{
    ::PostMessage(m_hWnd, WM_HBAR_SEARCH_PREV, HBAR_SEARCHPREVFAILED, HBAR_SEARCHPREVFAILED);
  }
  return 0;
}
开发者ID:henrywoo,项目名称:ultraie,代码行数:35,代码来源:H_HBarWnd.cpp


示例5: CheckIp

BOOL CSetProxServer::CheckIp( ATL::CString& str )//检查IP地址是否合法
{
	LPCWSTR   lpIpString = str.GetBuffer(-1);
	str.ReleaseBuffer(-1);
	int      nStrLen = 0; 
	int      nDotCount = 0; 

	nStrLen = wcslen(lpIpString); 
	if((nStrLen > 15) || (nStrLen < 7)) 
		return FALSE; 

	for(int i=0; i < nStrLen; ++i) 
	{ 
		if( lpIpString[i] == L'.' ) 
		{ 
			if( (lpIpString[i+1] == '.') || (i==0) || (i==nStrLen-1))
				return FALSE; 
			nDotCount++; 
			continue; 
		} 

		if( (lpIpString[i] < L'0') || (lpIpString[i] > L'9') )
			return   FALSE; 
	} 

	if( nDotCount == 3) 
	{ 
		if(inet_addr(CW2A(str.GetBuffer(-1))) != INADDR_NONE) 
		{ 
			return TRUE; 
		} 
	} 

	return FALSE;
}
开发者ID:dreamsxin,项目名称:PcManager,代码行数:35,代码来源:setProxServer.cpp


示例6: TimeToString

//////////////////////////////////////////////////////////////////////////
//时间与字符串互相转换函数
ATL::CString GlobeFuns::TimeToString(const CTime &t)
{
	ATL::CString strDateTime;
	strDateTime.Format("%d-%02d-%02d %02d:%02d:%02d", 
		t.GetYear(), t.GetMonth(), t.GetDay(),
		t.GetHour(), t.GetMinute(), t.GetSecond());
	return strDateTime;
}
开发者ID:blog2i2j,项目名称:greentimer,代码行数:10,代码来源:GlobeFuns.cpp


示例7: GetStringValue

ATL::CString GetStringValue(CRegKey& rk, const ATL::CString& valueName)
{
	ATL::CString result;
	DWORD dwLen = 1024;
	rk.QueryStringValue(valueName, result.GetBuffer(dwLen), &dwLen);
	result.ReleaseBuffer();
	return result;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:8,代码来源:GenericCLRLoader.cpp


示例8: OnDropFiles

void MainDialog::OnDropFiles(HDROP hdrop)
{
	ATL::CString path;
	UINT len = DragQueryFile(hdrop, 0, NULL, 0);
	char *pch = path.GetBufferSetLength(len);
	if(DragQueryFile(hdrop, 0, pch, len + 1)) {
		m_xml = pch;
		DoDataExchange(false, IDC_XML);
		EnableDlgItem(IDC_START);
	}
	DragFinish(hdrop);
}
开发者ID:Tietew,项目名称:mediawiki-xml2sql,代码行数:12,代码来源:xml2sql-fe.cpp


示例9:

 PluginMng::~PluginMng(){
   for (int i=0;i<(int)plugins_.size();i++){
     uuplugin* uup = plugins_.at(i);
     CRegKey crk;
     long rk=crk.Open(HKEY_LOCAL_MACHINE, _6bees_const::kplugindisabled, KEY_READ|KEY_WRITE);
     if (rk==ERROR_SUCCESS){
       ATL::CString menuid;
       menuid.Format(_T("%d"),uup->menuwID_);
       if(uup->enabled_){
         crk.DeleteValue(menuid);
       }else{
         crk.SetDWORDValue(menuid,1);
       }
     }
   }
 }
开发者ID:henrywoo,项目名称:ultraie,代码行数:16,代码来源:pluginmng.cpp


示例10: thread_getalexa

  UINT WINAPI alexa::thread_getalexa(LPVOID p){
    alexainfo* pas = static_cast<alexainfo*>(p);
    int alexarank = 0;
    std::wstring hostname(pas->hostname.c_str());
    if(url2alexa.find(hostname)==url2alexa.end()){
      alexarank = GetAlexaRank(pas->hostname.c_str());
      url2alexa[hostname] = alexarank;
    }else{
      alexarank = url2alexa[hostname];
    }

    ATL::CString stralexa;
    stralexa.Format(L"%d",alexarank);
    pas->alexaptr->tid2panetext_[pas->tid] = stralexa;
    if(IsWindow(pas->psb->m_hWnd))
      pas->psb->SetText(pas->paneid,stralexa);
    return 0;
  }
开发者ID:henrywoo,项目名称:ultraie,代码行数:18,代码来源:alexa.cpp


示例11: TimeToString

HRESULT TimeToString( __time64_t nTime, ATL::CString& strTime )
{
	ATL::CTime time(nTime);
	strTime.Format( TEXT("%d %d %d %d:%d:%d"), 
		time.GetYear(), time.GetMonth(), 
		time.GetDay(), time.GetHour(), 
		time.GetMinute(),time.GetSecond());

	return S_OK;
}
开发者ID:6520874,项目名称:pcmanager,代码行数:10,代码来源:logtools.cpp


示例12: GetCurrentThreadId

  bool alexa::OnNavigateComplete2(int paneid,const wchar_t* url){
    C6BeeMenuStatusBar* pSB = GetC6BeeMenuStatusBarPtr();
    if (pSB==NULL){
      return false;
    }
    ATL::CString myurl = url;
    if(myurl.Find(_T("http://"))!=0){
      return false;
    }
    int cut=myurl.Find(_T("/"),8);
    if (cut<0){return false;}
    myurl.Truncate(cut);

    alexa_info.paneid = paneid;
    alexa_info.hostname = myurl;
    alexa_info.psb = pSB;
    alexa_info.tid = GetCurrentThreadId();
    alexa_info.alexaptr = this;
    ::_beginthreadex(NULL,0,thread_getalexa,
      (LPVOID)&alexa::alexa_info,0,NULL);
    return true;
  }
开发者ID:henrywoo,项目名称:ultraie,代码行数:22,代码来源:alexa.cpp


示例13: OnCtlColorEdit

LRESULT CH_HBarWnd::OnCtlColorEdit(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL& bHandled){
  HDC hdcEdit   = (HDC)  wParam; // handle to display context 
  HWND hwndEdit = (HWND) lParam; // handle to static control 
  if (hwndEdit==m_BandEditCtrl.m_hWnd)
  {
    CComBSTR search_words = NULL;
    m_BandEditCtrl.GetWindowText(&search_words);
    ATL::CString sw = search_words.m_str;
    if(sw.IsEmpty() && bkcolor!=kGreen){
      bkcolor = kGreen;
      m_hBrush = ::CreateSolidBrush(bkcolor);
      RECT rc;
      m_BandEditCtrl.GetClientRect(&rc);
      m_BandEditCtrl.InvalidateRect(&rc,TRUE);
    }
    if (m_hBrush == NULL)
      m_hBrush = ::CreateSolidBrush(bkcolor);
    SetBkColor(hdcEdit,bkcolor);
    SetTextColor(hdcEdit, RGB(0,20,245));
    return ((LRESULT) m_hBrush);
  }
  return 0;
}
开发者ID:henrywoo,项目名称:ultraie,代码行数:23,代码来源:H_HBarWnd.cpp


示例14: OnClicked_BtnOK

LRESULT CSiteSelectedBoxWnd::OnClicked_BtnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	ATL::CString strName;
	m_ctrlSiteCombo.GetLBText(m_ctrlSiteCombo.GetCurSel(), strName);

	map<TSTLSTRING, TSTLSTRING>::iterator iterSite = m_SiteMap.find(strName.GetString());
	if(iterSite == m_SiteMap.end())
	{
		MessageBox(TEXT("您没有选择站点?"), TEXT("提示"), MB_OK|MB_ICONINFORMATION);
		bHandled = TRUE;
		return 0;
	}

	try
	{
		ConfigureManager::GetInstance().SetSettingValue(TEXT("sitename"), iterSite->second);
		ConfigureManager::GetInstance().Save();
	}
	catch(Exception& error)
	{
		MessageBox(error.GetMessage().c_str(), TEXT("错误"), MB_OK|MB_ICONERROR);
	}

	DestroyWindow();
	if(!OnSelected.m_EventList.empty())
	{
		Event< SiteSelected >::EventIterator iter;
		for( iter = OnSelected.m_EventList.begin();
			iter != OnSelected.m_EventList.end();
			++iter )
		{
			InvokeEvent(true, iterSite->second);
		}
	}
	bHandled = TRUE;
	return 0;
}
开发者ID:NickeyWoo,项目名称:EditorAssistant,代码行数:37,代码来源:SiteSelectedBoxWnd.cpp


示例15: WSCoCreateDotNetInstancePtr

IUnknownPtr GenericCLRLoader::WSCoCreateDotNetInstancePtr(const CLSID& clsid)
{
	LPOLESTR szClsid;
	HRESULT hr = StringFromCLSID(clsid, &szClsid);
	if (FAILED(hr))
		throw _com_error(hr);
	ATL::CString sClsid = szClsid;
	CoTaskMemFree(szClsid);

	CRegKey rkCLSID;
	hr = rkCLSID.Open(HKEY_CLASSES_ROOT, L"CLSID\\" + sClsid + L"\\InprocServer32", KEY_READ);
	if (hr != ERROR_SUCCESS)
		throw _com_error(HRESULT_FROM_WIN32(hr));

	ATL::CString sAssembly = GetStringValue(rkCLSID, L"Assembly");
	ATL::CString sClass = GetStringValue(rkCLSID, L"Class");
	ATL::CString sCodeBase = GetStringValue(rkCLSID, L"CodeBase");

	if (sAssembly.GetLength() == 0 || sClass.GetLength() == 0 || sCodeBase.GetLength() == 0)
		throw _com_error(REGDB_E_CLASSNOTREG);

	ATL::CString dllPath;
	ATL::CString strFilePrefix(_T("file:///"));
	if (sCodeBase.Left(strFilePrefix.GetLength()).MakeLower() == strFilePrefix)
	{
		dllPath = sCodeBase.Mid(strFilePrefix.GetLength()); // discard 'file:///'
	}
	else
	{
		dllPath = sCodeBase;
	}

	IUnknownPtr result;

	hr = TheInstance()->CreateCOMObject(dllPath, sAssembly, sClass, &result);
	if (FAILED(hr))
		throw _com_error(hr);

	return result;

}
开发者ID:killbug2004,项目名称:WSProf,代码行数:41,代码来源:GenericCLRLoader.cpp


示例16: CreateObject

// an instance of the requested add-in in that AppDomain.
HRESULT GenericCLRLoader::CreateObject(const ATL::CString& sAssemblyFile, const ATL::CString& sAssemblyName, const ATL::CString& sTypeName, 
	mscorlib::_ObjectHandle** ppObject, const ATL::CString& sConfigFile, const ATL::CString& sDomainName, int LocaleID)
{
	HRESULT hr = E_FAIL;

	try
	{
		m_skipCleanup = true;


		// Ensure the common language runtime is running ...
		IfFailGo( LoadCLR(sAssemblyFile) );

		// In order to securely load an assembly, its fully qualified strong name
		// and not the filename must be used. To do that, the target AppDomain's 
		// base directory needs to point to the directory where the assembly is
		// residing. CreateLocalAppDomain() ensures that such AppDomain exists.
		//
		// VE3580 "Error:0x8000ffff is seen only on the first save to SharePoint. Windows XP SP3 with Office 2003"
		// If no config file is specified when creating the appdomain the first time a Uri object is created an exception is thrown,
		// Its trying to read a config file that is NULL. So specify a dummy file name to prevent this.
		IfFailGo( CreateLocalAppDomain(sDomainName, sConfigFile.IsEmpty() ? "app.config" : sConfigFile) );

		// Create an instance of the managed class
		if (LocaleID != -1)
			m_pLocalDomain->SetData(CComBSTR("LocaleID"), CComVariant(LocaleID));
		
		IfFailGo(m_pLocalDomain->CreateInstance(CComBSTR(sAssemblyName), CComBSTR(sTypeName), ppObject));
	}
	catch(...)
	{
		LOG_WS_INFO(_T("Unable to load clr, create app domain, run CLRPolicyReader"));
	}

Error:
	return hr;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:38,代码来源:GenericCLRLoader.cpp


示例17: HasChineseChar

//----------------------------------------------        
//modified by robet.li
BOOL HasChineseChar(const ATL::CString &destStr)
{
	BOOL bHasChinsesChar = FALSE;
	int nLen = destStr.GetLength();
	unsigned char c1,c2;
	BOOL bFirstSpace = TRUE;

	for(int i=0; i<nLen; i++)
	{
		c1 = destStr[i];

		if((i+1) >= nLen)
		{
			if (bFirstSpace && (c1 == ' ' || c1 == '\t'))
			{
			}
			else
			{
				//strConv += destStr[i];
				bFirstSpace = FALSE;
			}
			break;
		}
		else
		{
			c2 = destStr[i+1];
			if(c1 == 163)  //ÅжÏÊÇ·ñΪȫ½Ç×Ö·û
			{
				//strConv += TCHAR(c2-128);
				i++;
				bFirstSpace = FALSE;
			}
			else if((int)c1 > 163) //ÅжÏÊÇ·ñΪÎÄ×Ö
			{
				//strConv += (TCHAR)c1;
				//strConv += (TCHAR)c2;
				i++;
				bFirstSpace = FALSE;
				bHasChinsesChar = TRUE;
				break;
			}
			else if((c1 == 161) && (c2 == 161)) //ȫΪ¿Õ¸ñ
			{
				i++;
			}
			else      //Èç¹ûÊÇ°ë½Ç×Ö·û
			{
				if (bFirstSpace && (c1 == ' ' || c1 == '\t'))
				{
				}
				else
				{
					//strConv += (TCHAR)c1;
					bFirstSpace = FALSE;
				}
			}//endi
		}
	}

	return bHasChinsesChar;
}
开发者ID:tasosbull,项目名称:yewtic,代码行数:63,代码来源:CppSQLite3.cpp


示例18: ReadSettingsAndSet

void CSetProxServer::ReadSettingsAndSet(int nFlag = -1)
{
	int				nType;
	TCHAR			sUser[256] = {0};
	TCHAR			sPass[256] = {0};
	TCHAR			sHost[256] = {0};		
	int				nPort = 80;
	int				nValidate;	
	ATL::CString	strPort = L"";
	CIniFile iniFile(m_strFilePath);
	iniFile.GetIntValue(L"proxy",	L"type",		nType);

	if (nFlag == -1)//
	{
		if (nType == -1)//第一次使用的情况
		{
			nType = 1;
			m_bChanged = TRUE;
		}		
	}	
	else
	{
		nType = nFlag;
	}	
	m_ComBoHttp.SetCurSel(nType);
	
	iniFile.GetIntValue(L"proxy",	L"validate",	nValidate);
	if (nValidate == -1)
	{
		nValidate = 1;//默认情况下是需要验证的
	}
	iniFile.GetStrValue(L"proxy",	L"host",		sHost,	sizeof(sHost));
	iniFile.GetIntValue(L"proxy",	L"port",		nPort);			
	iniFile.GetStrValue(L"proxy",	L"user",		sUser,	sizeof(sUser));
	iniFile.GetStrValue(L"proxy",	L"password",	sPass,	sizeof(sPass));
	
	HWND hWndVerify   = ::GetDlgItem(GetViewHWND(), IDC_COMBO_PROX_SERVER_VERIFY);
	HWND hWndAddr     = ::GetDlgItem(GetViewHWND(), IDC_EDITBOX_PROX_SERVER_ADDR);
	HWND hWndPort     = ::GetDlgItem(GetViewHWND(), IDC_EDITBOX_PROX_SERVER_PORT);
	HWND hWndAccount  = ::GetDlgItem(GetViewHWND(), IDC_EDITBOX_PROX_SERVER_ACCOUNT);
	HWND hWndPass     = ::GetDlgItem(GetViewHWND(), IDC_EDITBOX_PROX_SERVER_PASS);
	if (nType == 0)//不使用的情况
 	{		
		::EnableWindow(hWndVerify,  FALSE);
		::EnableWindow(hWndAddr,	FALSE);
		::EnableWindow(hWndPort,	FALSE);
		::EnableWindow(hWndAccount, FALSE);
		::EnableWindow(hWndPass,	FALSE);
		ReSet();
	}
	else
	{		
		if (nPort == -1)
		{
			if (nType == 1)
				nPort = 80;
			else if (nType == 2)
				nPort = 1080;
		}
		strPort.Format(L"%d", nPort);
		::EnableWindow(hWndVerify,  TRUE);
		::EnableWindow(hWndAddr,	TRUE);
		::EnableWindow(hWndPort,	TRUE);
		::EnableWindow(hWndAccount, nValidate);
		::EnableWindow(hWndPass,	nValidate);
		if (nValidate <= 0)//不需要验证的时候
		{	
			memset(sUser, 0, sizeof(sUser));
			memset(sPass, 0, sizeof(sUser));
		}		
		m_ComBoVerify.SetCurSel(nValidate);
		m_wndEditAddr.SetWindowText(sHost);
		m_wndEditPort.SetWindowText(strPort);
		m_wndEditAccount.SetWindowText(sUser);
		m_wndEditPass.SetWindowText(sPass);
	}	
	return;
}
开发者ID:dreamsxin,项目名称:PcManager,代码行数:78,代码来源:setProxServer.cpp


示例19: MakeFilterString

inline void MakeFilterString(ATL::CString& str)
{
	char *pch = str.GetBuffer();
	for(int i = 0; i < str.GetLength(); ++i)
		if(pch[i] == '|') pch[i] = '\0';
}
开发者ID:Tietew,项目名称:mediawiki-xml2sql,代码行数:6,代码来源:xml2sql-fe.cpp


示例20: IsMatchFilterElementHide

bool CFilterElementHide::IsMatchFilterElementHide(IHTMLElement* pEl) const
{
  HRESULT hr;

  if (!m_tagId.IsEmpty())
  {
    CComBSTR id;
    hr = pEl->get_id(&id);
    if ((hr != S_OK) || (id != CComBSTR(m_tagId)))
    {
      return false;
    }
  }
  if (!m_tagClassName.IsEmpty())
  {
    CComBSTR classNameBSTR;
    hr = pEl->get_className(&classNameBSTR);
    if (hr == S_OK)
    {
      CString className = classNameBSTR;
      int start = 0;
      CString specificClass;
      bool foundMatch = false;
      while ((specificClass = className.Tokenize(L" ", start)) != L"")
      {
        // TODO: Consider case of multiple classes. (m_tagClassName can be something like "foo.bar")
        if (specificClass == m_tagClassName)
        {
          foundMatch = true;
        }
      }
      if (!foundMatch)
      {
        return false;
      }
    }
  }
  if (!m_tag.IsEmpty())
  {
    CComBSTR tagName;
    hr = pEl->get_tagName(&tagName);
    tagName.ToLower();
    if ((hr != S_OK) || (tagName != CComBSTR(m_tag)))
    {
      return false;
    }
  }

  // Check attributes
  for (std::vector<CFilterElementHideAttrSelector>::const_iterator attrIt = m_attributeSelectors.begin(); 
        attrIt != m_attributeSelectors.end(); ++ attrIt)
  {
    ATL::CString value;
    bool attrFound = false;
    if (attrIt->m_type == CFilterElementHideAttrType::STYLE)
    {
      CComPtr<IHTMLStyle> pStyle;
      if (SUCCEEDED(pEl->get_style(&pStyle)) && pStyle)
      {
        CComBSTR bstrStyle;

        if (SUCCEEDED(pStyle->get_cssText(&bstrStyle)) && bstrStyle)
        {
          value = bstrStyle;
          value.MakeLower();
          attrFound = true;
        }
      }
    }
    else if (attrIt->m_type == CFilterElementHideAttrType::CLASS)
    {
      CComBSTR bstrClassNames;
      if (SUCCEEDED(pEl->get_className(&bstrClassNames)) && bstrClassNames)
      {
        value = bstrClassNames;
        attrFound = true;
      }
    }
    else if (attrIt->m_type == CFilterElementHideAttrType::ID)
    {
      CComBSTR bstrId;
      if (SUCCEEDED(pEl->get_id(&bstrId)) && bstrId)
      {
        value = bstrId;
        attrFound = true;
      }
    }
    else
    {
      auto attributeValue = GetHtmlElementAttribute(*pEl, attrIt->m_bstrAttr);
      if (attrFound = attributeValue.isAttributeFound)
      {
        value = ToCString(attributeValue.attributeValue);
      }
    }

    if (attrFound)
    {
      if (attrIt->m_pos == CFilterElementHideAttrPos::EXACT)
      {
//.........这里部分代码省略.........
开发者ID:junaidnaseer,项目名称:adblockplusie,代码行数:101,代码来源:PluginFilter.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ message::Element类代码示例发布时间:2022-05-31
下一篇:
C++ atl::CRegKey类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap