コード例 #1
0
ファイル: H_HBarWnd.cpp プロジェクト: henrywoo/ultraie
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;
}
コード例 #2
0
ファイル: H_HBarWnd.cpp プロジェクト: henrywoo/ultraie
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;
}
コード例 #3
0
// 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;
}