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


C++ CComVariant类代码示例

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


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

示例1: strrchr

HRESULT CbRoot::SetBaseHwInfo()
{
    CComPtr<IProp> prop;        

    char tmpString[512];
    
    // we expect the ini file to be in the same directory as the application,
    // namely, this DLL. It's the only way to find the file if it's not
    // in the windows subdirectory

    if (GetModuleFileName(_Module.GetModuleInstance(), tmpString, 512)==0)
        return E_FAIL;
    // replace .dll with .ini
    strrchr(tmpString, '.' )[1]='\0';
    strcat(tmpString,"ini"); 
    _iniFileName=tmpString;


    cbGetBoardName(_BoardNum,tmpString);
    ATLTRACE2(MCC_UL_CALL,3,"cbGetBoardName(_BoardNum = %i, tmpString); result tmpString = %s\n",_BoardNum,tmpString);
    _boardName=tmpString;
    _iniSection=_boardName;  

    CBI_CHECK(cbGetConfig(BOARDINFO, _BoardNum, 0, BIBOARDTYPE, &_BoardType));
    ATLTRACE2(MCC_UL_CALL,3,"cbGetConfig (BOARDINFO,_BoardNum = %d,0,BIBOARDTYPE, &_BoardType); result: _BoardType=%d\n",_BoardNum,_BoardType);
    long id=GetFromIni(_T("ID"),0L);
    if (id==0)
    {
        _engine->WarningMessage(CComBSTR("Board not found in mwmcc.ini file.  Board is not supported but may work.")); 
    }
    // Check to see if this is a DEMO-BOARD (code 45)
    else if (_BoardType == 45)
    {
        // Geck 224706:  When people create a DEMO-BOARD device, they probably didn't mean to.
        // Give them a warning to indicate that they might want to recosider this.
        _engine->WarningMessage(CComBSTR("The ID value selected is associated with Measurement Computing's virtual DEMO-BOARD. This virtual software device provides simulated data for demo purposes. Use a different ID if this was not your intent."));
    }
    else if (id!=_BoardType)
    {
        _engine->WarningMessage(CComBSTR("BoardType from Ini file does not match that returned from universal libray."));
        _RPT2(_CRT_WARN,"BoardType from ini file is %d board type from unilib is %d\n",id,_BoardType);
    }
    

    // device Id
    wchar_t Str[80];
    swprintf(Str, L"%d", _BoardNum);
    DEBUG_HRESULT(_DaqHwInfo->put_MemberValue(CComBSTR(L"id"), CComVariant(Str)));		
    DEBUG_HRESULT(_DaqHwInfo->put_MemberValue(CComBSTR(L"adaptorname"), CComVariant(L"mcc")));

    DEBUG_HRESULT(_DaqHwInfo->put_MemberValue(CComBSTR(L"vendordriverdescription"),
	CComVariant(L"Measurement Computing Universal Library")));
    
    
    // Get the UL Revision numbers
    float DllRevNum, DriverRevNum;
    
	cbGetRevision (&DllRevNum, &DriverRevNum);
    ATLTRACE2(MCC_UL_CALL,3,"cbGetRevision (&DllRevNum,&DriverRevNum); result: DllRevNum=%d,DriverRevNum=%d\n",DllRevNum,DriverRevNum);

	// Make a call to get the decimal (.xxx) value of the minor revision number.
	// Add this to the major revision number (y.xxx)
	DllRevNum += GetDriverMinorRevision();

	CComVariant var = DllRevNum;
	var.ChangeType(VT_BSTR);

    DEBUG_HRESULT( _DaqHwInfo->put_MemberValue(CComBSTR(L"vendordriverversion"), var));

    DEBUG_HRESULT(_DaqHwInfo->put_MemberValue(CComBSTR(L"devicename"),variant_t(_boardName)));
    
    return S_OK;
}
开发者ID:motor,项目名称:clock_stimulus,代码行数:73,代码来源:cbUtil.cpp

示例2: GetModuleFileName

/////////////////////////////////////////////////////////////////////////////
// AdaptorInfo()
//
// The function is used to elicit relevant info about the current HW..
//..configuration from the HW API.
//  The info to extract is:
//..1)number of boards installed
//..2)board names
//..3)supported subsystems (AnalogInput, AnalogOutput, DigitalIO)
// The function is called by the engine in response to the ML user..
//..command DAQHWINFO 
/////////////////////////////////////////////////////////////////////////////
HRESULT Cadvantechadapt::AdaptorInfo(IPropContainer * Container)
{
	LONG lDriverHandle = (LONG)NULL;          // driver handle
	PT_DeviceGetFeatures ptDevFeatures;		// Devfeatures table
	DEVFEATURES DevFeatures;					// structure for device features
	
	int i = 0;          // Index variable
	
	// Get the name of the adaptor module
	TCHAR name[256];
	GetModuleFileName(_Module.GetModuleInstance(),name,256); // null returns MATLAB version (non existant)
	RETURN_HRESULT(Container->put_MemberValue(L"adaptordllname",CComVariant(name)));
	
	// Place the adaptor name in the appropriate struct in the engine.
	RETURN_HRESULT(Container->put_MemberValue(L"adaptorname",variant_t(ConstructorName)));
	
	// Find board IDs
	// Start by obtaining the DeviceList. Not stored.
	short numDevices;			// Number of devices
	DEVLIST deviceList[MaxDev]; // Space to store device information.
	CComVariant var;			// General CComVariant to return info to adaptor engine.
	RETURN_ADVANTECH(DRV_DeviceGetList((DEVLIST far *)&deviceList[0], MaxDev, &numDevices));
	
	// Create storage for board IDs, bord names and constructors.
	TSafeArrayVector<CComBSTR> IDs;			// Create A SafeArrayVector to store the IDs in
	IDs.Allocate(numDevices);				// Allocate the memory for the number of devices
	TSafeArrayVector<CComBSTR> Names;		// Create A SafeArrayVector to store the Names in
	Names.Allocate(numDevices);				// Allocate the memory for the number of devices
	SAFEARRAY *ps;							// SafeArray for the subsystem support [nDx3 CComBStrs]
	CComBSTR *subsystems;
	SAFEARRAYBOUND arrayBounds[2]; 
	arrayBounds[0].lLbound = 0;
	arrayBounds[0].cElements = numDevices;    
	arrayBounds[1].lLbound = 0;
	arrayBounds[1].cElements = 3;			// AnalogInput, AnalogOutput, DigitalIO subsystems.
	ps = SafeArrayCreate(VT_BSTR, 2, arrayBounds);
	if (ps==NULL)
		return E_FAIL;      
	
	// Set up the variant to contain subsystem constructor SafeArray
	var.parray = ps;
	var.vt = VT_ARRAY | VT_BSTR;
	HRESULT hRes = SafeArrayAccessData(ps, (void **)&subsystems);
	if (FAILED (hRes)) 
	{
		SafeArrayDestroy (ps);
		return hRes;
	}
	
	// Now loop through each device, getting the ID, BoardName and subsystem support.
	wchar_t str[40];
	for (i=0; i < numDevices; i++)
	{
		// Allocate the ID
		char* string;
		string = new char[20];
		_ltoa(deviceList[i].dwDeviceNum, string, 10);
		IDs[i] = CComBSTR(string);
		
		// Open Device
		RETURN_ADVANTECH(DRV_DeviceOpen(deviceList[i].dwDeviceNum,(LONG far *)&lDriverHandle));
		
		// Get BoardNames info
		Names[i] = CComBSTR(deviceList[i].szDeviceName);
		
		// Check to see which subsystems the current board supports.
		// Get device features
		ptDevFeatures.buffer = (LPDEVFEATURES)&DevFeatures;
		ptDevFeatures.size = sizeof(DEVFEATURES);
		RETURN_ADVANTECH(DRV_DeviceGetFeatures(lDriverHandle, (LPT_DeviceGetFeatures)&ptDevFeatures));
		if ((DevFeatures.usMaxAIDiffChl + DevFeatures.usMaxAISiglChl) > 0) 
		{
			swprintf(str, L"analoginput('%s',%s)", (wchar_t*)ConstructorName, (wchar_t*)IDs[i]);
			subsystems[i]=str;
		}
		if (DevFeatures.usMaxAOChl > 0)
		{
			swprintf(str, L"analogoutput('%s',%s)", (wchar_t*)ConstructorName, (wchar_t*)IDs[i]);
			subsystems[i + numDevices]=str;
		}
		if ((DevFeatures.usMaxDIChl + DevFeatures.usMaxDOChl) > 0)
		{
			swprintf(str, L"digitalio('%s',%s)",(wchar_t*) ConstructorName, (wchar_t*)IDs[i]);
			subsystems[i + 2*numDevices] = str;
		}  
		// Close device
		RETURN_ADVANTECH(DRV_DeviceClose((LONG far *)&lDriverHandle));
	}
//.........这里部分代码省略.........
开发者ID:motor,项目名称:clock_stimulus,代码行数:101,代码来源:advantechadapt.cpp

示例3: UpdateNodeFromItem

void CPageEvents::OnOK() 
{
  // Save any changes made to the currently-selected node's attributes
  UpdateNodeFromItem(m_lParamSelected);

  // Inspect the <Event> nodes of the document
  if (NULL != m_spXMLDoc)
  {
    // Get all of the <Event> nodes in the document
    IXMLDOMNodeListPtr spNodeList;
    VERIFY(SUCCEEDED(m_spXMLDoc->getElementsByTagName(m_bstrEvent,
      &spNodeList)));

    // Process each node
    IXMLDOMNodePtr spNode;
    do  
    {
      // Get the next node of the child list
      VERIFY(SUCCEEDED(spNodeList->nextNode(&spNode)));
      if (NULL != spNode)
      {
        // Query for the IXMLDOMElement interface
        IXMLDOMElementPtr spElement(spNode);
        ASSERT(NULL != spElement);

        // Get the event id attribute
        CComVariant varEventID;
        spElement->getAttribute(m_bstrID, &varEventID);
        VERIFY(SUCCEEDED(varEventID.ChangeType(VT_I4)));
        AGCEventID idEventBegin = (AGCEventID)(V_UI4(&varEventID));
        AGCEventID idEventEnd = (AGCEventID)(idEventBegin + 1);

        // Get the LogAsNTEvent attribute
        IXMLDOMAttributePtr spAttrNT;
        if (S_OK == spElement->getAttributeNode(m_bstrLogAsNTEvent, &spAttrNT))
        {
          CComVariant varLog2NT;
          spAttrNT->get_value(&varLog2NT);
          VERIFY(SUCCEEDED(varLog2NT.ChangeType(VT_BOOL)));

          // Add this event id to the range, if it should be logged
          if (V_BOOL(&varLog2NT))
            m_spRangesNT->AddByValues(idEventBegin, idEventEnd);
        }

        // Get the LogAsDBEvent attribute
        IXMLDOMAttributePtr spAttrDB;
        if (S_OK == spElement->getAttributeNode(m_bstrLogAsDBEvent, &spAttrDB))
        {
          CComVariant varLog2DB;
          spAttrDB->get_value(&varLog2DB);
          VERIFY(SUCCEEDED(varLog2DB.ChangeType(VT_BOOL)));

          // Add this event id to the range, if it should be logged
          if (V_BOOL(&varLog2DB))
            m_spRangesDB->AddByValues(idEventBegin, idEventEnd);
        }
      }
    } while (NULL != spNode);

    // Set the enabled ranges of the event logger object
    VERIFY(SUCCEEDED(m_spEventLogger->put_EnabledNTEvents(m_spRangesNT)));
    VERIFY(SUCCEEDED(m_spEventLogger->put_EnabledDBEvents(m_spRangesDB)));
  }

  // Perform default processing
  CPropertyPage::OnOK();
}
开发者ID:FreeAllegiance,项目名称:Allegiance-R7-With-R4-Engine,代码行数:68,代码来源:PageEvents.cpp

示例4: spDispatchtmp

HRESULT CAzApplication::CreateScopes(CAzApplication &pApp){

    CAzLogging::Entering(_TEXT("CAzApplication::CreateScopes"));

    CComPtr<IAzScopes> spAzScopes;

    CComVariant cVappl;

    long lCount=0;

    HRESULT hr=pApp.m_native->get_Scopes(&spAzScopes);

    CAzLogging::Log(hr,_TEXT("Getting scopes for IAzApplication"),COLE2T(getName()));

    if (FAILED(hr))
        goto lError1;

    hr=spAzScopes->get_Count(&lCount);

    CAzLogging::Log(hr,_TEXT("Getting operation count for IAzApplication from IAzOperations"),COLE2T(getName()));

    if (FAILED(hr))
        goto lError1;

    if (lCount==0)	
        goto lError1;
    for (long i = 1 ; i <= lCount ; i++) {

        CComPtr<IAzScope> spSrcScope,spNewScope;

        hr = spAzScopes->get_Item(i,&cVappl);

        CAzLogging::Log(hr,_TEXT("Getting scope object"),COLE2T(getName()));

        if (FAILED(hr))
            goto lError1;

        CComPtr<IDispatch> spDispatchtmp(cVappl.pdispVal);

        cVappl.Clear();

        hr = spDispatchtmp.QueryInterface(&spSrcScope);		

        if (FAILED(hr))
            goto lError1;

        CAzScope srcScope=CAzScope(spSrcScope,false);

        hr=m_native->CreateScope(srcScope.getName(),CComVariant(),&spNewScope);

        CAzLogging::Log(hr,_TEXT("Creating scope for IAzApplication"),COLE2T(getName()));

        if (FAILED(hr))
            goto lError1;

        CAzScope newScope=CAzScope(spNewScope,true);

        hr = newScope.Copy(srcScope);

        CAzLogging::Log(hr,_TEXT("Copying IAzScope properties for IAzApplication"),COLE2T(getName()));

        if (FAILED(hr))
            goto lError1;
    }
lError1:
    CAzLogging::Exiting(_TEXT("CAzApplication::CreateScopes"));

    return hr;
}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:69,代码来源:AzApplication.cpp

示例5: LOG

int Script::ExecuteAsync(int timeout_in_milliseconds) {
  LOG(TRACE) << "Entering Script::ExecuteAsync";
  int return_code = WD_SUCCESS;

  CComVariant result = L"";
  CComBSTR error_description = L"";

  AsyncScriptExecutorThreadContext thread_context;
  thread_context.script_source = this->source_code_.c_str();
  thread_context.script_argument_count = this->argument_count_;

  // We need exclusive access to this event. If it's already created,
  // OpenEvent returns non-NULL, so we need to wait a bit and retry
  // until OpenEvent returns NULL.
  int retry_counter = 50;
  HANDLE event_handle = ::OpenEvent(SYNCHRONIZE, FALSE, ASYNC_SCRIPT_EVENT_NAME);
  while (event_handle != NULL && --retry_counter > 0) {
    ::CloseHandle(event_handle);
    ::Sleep(50);
    event_handle = ::OpenEvent(SYNCHRONIZE, FALSE, ASYNC_SCRIPT_EVENT_NAME);
  }

  // Failure condition here.
  if (event_handle != NULL) {
    ::CloseHandle(event_handle);
    LOG(WARN) << "OpenEvent() returned non-NULL, event already exists.";
    result.Clear();
    result.vt = VT_BSTR;
    error_description = L"Couldn't create an event for synchronizing the creation of the thread. This generally means that you were trying to click on an option in two different instances.";
    result.bstrVal = error_description;
    this->result_.Copy(&result);
    return EUNEXPECTEDJSERROR;
  }

  LOG(DEBUG) << "Creating synchronization event for new thread";
  event_handle = ::CreateEvent(NULL, TRUE, FALSE, ASYNC_SCRIPT_EVENT_NAME);
  if (event_handle == NULL || ::GetLastError() == ERROR_ALREADY_EXISTS) {
    if (event_handle == NULL) {
      LOG(WARN) << "CreateEvent() failed.";
      error_description = L"Couldn't create an event for synchronizing the creation of the thread. This is an internal failure at the Windows OS level, and is generally not due to an error in the IE driver.";
    } else {
      ::CloseHandle(event_handle);
      LOG(WARN) << "Synchronization event is already created in another instance.";
      error_description = L"Couldn't create an event for synchronizing the creation of the thread. This generally means that you were trying to click on an option in multiple different instances.";
    }
    result.Clear();
    result.vt = VT_BSTR;
    result.bstrVal = error_description;
    this->result_.Copy(&result);
    return EUNEXPECTEDJSERROR;
  }

  // Start the thread and wait up to 1 second to be signaled that it is ready
  // to receive messages, then close the event handle.
  LOG(DEBUG) << "Starting new thread";
  unsigned int thread_id = 0;
  HANDLE thread_handle = reinterpret_cast<HANDLE>(_beginthreadex(NULL,
                                                  0,
                                                  AsyncScriptExecutor::ThreadProc,
                                                  reinterpret_cast<void*>(&thread_context),
                                                  0,
                                                  &thread_id));

  LOG(DEBUG) << "Waiting for new thread to be ready for messages";
  DWORD event_wait_result = ::WaitForSingleObject(event_handle, 5000);
  if (event_wait_result != WAIT_OBJECT_0) {
    LOG(WARN) << "Waiting for event to be signaled returned unexpected value: " << event_wait_result;
  }
  ::CloseHandle(event_handle);

  if (thread_handle == NULL) {
    LOG(WARN) << "_beginthreadex() failed.";
    result.Clear();
    result.vt = VT_BSTR;
    error_description = L"Couldn't create the thread for executing JavaScript asynchronously.";
    result.bstrVal = error_description;
    this->result_.Copy(&result);
    return EUNEXPECTEDJSERROR;
  }

  HWND executor_handle = thread_context.hwnd;

  // Marshal the document and the element to click to streams for use in another thread.
  LOG(DEBUG) << "Marshaling document to stream to send to new thread";
  LPSTREAM document_stream;
  HRESULT hr = ::CoMarshalInterThreadInterfaceInStream(IID_IHTMLDocument2, this->script_engine_host_, &document_stream);
  if (FAILED(hr)) {
    LOGHR(WARN, hr) << "CoMarshalInterfaceThreadInStream() for document failed";
    result.Clear();
    result.vt = VT_BSTR;
    error_description = L"Couldn't marshal the IHTMLDocument2 interface to a stream. This is an internal COM error.";
    result.bstrVal = error_description;
    this->result_.Copy(&result);
    return EUNEXPECTEDJSERROR;
  }

  ::SendMessage(executor_handle, WD_ASYNC_SCRIPT_SET_DOCUMENT, NULL, reinterpret_cast<LPARAM>(document_stream));
  for (size_t index = 0; index < this->argument_array_.size(); ++index) {
    CComVariant arg = this->argument_array_[index];
    WPARAM wparam = static_cast<WPARAM>(arg.vt);
//.........这里部分代码省略.........
开发者ID:rdesoky,项目名称:selenium,代码行数:101,代码来源:Script.cpp

示例6: getVariant

FB::variant ActiveXBrowserHost::getVariant(const VARIANT *cVar)
{
    CComVariant converted;
    FB::variant retVal;

    switch(cVar->vt)
    {        
    case VT_R4:
    case VT_R8:
    case VT_DECIMAL:
        converted.ChangeType(VT_R8, cVar);
        retVal = (double)converted.dblVal;
        break;

    case VT_I1:
    case VT_I2:
    case VT_I4:
    case VT_UI1:
    case VT_UI2:
    case VT_INT:
        converted.ChangeType(VT_I4, cVar);
        retVal = (long)converted.lVal;
        break;
    case VT_UI4:
    case VT_UINT:
        converted.ChangeType(VT_UI4, cVar);
        retVal = (unsigned long)converted.ulVal;
        break;

    case VT_I8:
        retVal = static_cast<boost::int64_t>(cVar->llVal);
        break;
    case VT_UI8:
        retVal = static_cast<boost::uint64_t>(cVar->ullVal);
    case VT_LPSTR:
    case VT_LPWSTR:
    case VT_BSTR:
    case VT_CLSID:
        {
            converted.ChangeType(VT_BSTR, cVar);
            std::wstring wStr(converted.bstrVal);

            // return it as a UTF8 std::string
            retVal = FB::wstring_to_utf8(wStr);
        }
        break;

    case VT_DISPATCH:
		retVal = FB::JSObjectPtr(IDispatchAPI::create(cVar->pdispVal, ptr_cast<ActiveXBrowserHost>(shared_ptr()))); 
        break;

    case VT_ERROR:
    case VT_BOOL:
        converted.ChangeType(VT_BOOL, cVar);
        retVal = (converted.boolVal == VARIANT_TRUE) ? true : false;
        break;

    case VT_NULL:
        retVal = FB::FBNull();
        break;

    case VT_EMPTY:
    default:
        // retVal is already empty, leave it such
        break;
    }

    return retVal;
}
开发者ID:physicsrob,项目名称:FireBreath,代码行数:69,代码来源:ActiveXBrowserHost.cpp

示例7: GetDoubleElement

static HRESULT WINAPI GetDoubleElement(VARTYPE type, SAFEARRAY* pSA, long idx, double* pRetVal)
{
    ATLASSERT(pRetVal);
    ATLASSERT(pSA);

    *pRetVal = 0.;

    HRESULT hr;
    CComVariant v;
    switch(type)
    {
    case VT_R8:
        return SafeArrayGetElement(pSA, &idx, pRetVal);
    case VT_VARIANT:
        hr = SafeArrayGetElement(pSA, &idx, &v);
        if(FAILED(hr))
        {
            return hr;
        }
        hr = v.ChangeType(VT_R8);
        if(FAILED(hr))
        {
            return hr;
        }
        *pRetVal = v.dblVal;
        break;
    case VT_BSTR:
        hr = SafeArrayGetElement(pSA, &idx, &v.bstrVal);
        if(FAILED(hr))
        {
            return hr;
        }
        v.vt = VT_BSTR;
        hr = v.ChangeType(VT_R8);
        if(FAILED(hr))
        {
            return hr;
        }
        *pRetVal = v.dblVal;
        break;
    case VT_I4:
        hr = SafeArrayGetElement(pSA, &idx, &v.lVal);
        if(FAILED(hr))
        {
            return hr;
        }
        v.vt = VT_I4;
        hr = v.ChangeType(VT_R8);
        if(FAILED(hr))
        {
            return hr;
        }
        *pRetVal = v.dblVal;
        break;
    case VT_UI4:
        hr = SafeArrayGetElement(pSA, &idx, &v.ulVal);
        if(FAILED(hr))
        {
            return hr;
        }
        v.vt = VT_I4;
        hr = v.ChangeType(VT_R8);
        if(FAILED(hr))
        {
            return hr;
        }
        *pRetVal = v.dblVal;
        break;
    }
    return S_OK;
}
开发者ID:ETAS-Eder,项目名称:busmaster,代码行数:71,代码来源:GraphElement.cpp

示例8: Load

HRESULT CControlState::Load( LPSTREAM pStm )
{
   HRESULT hr = S_OK;
   CComVariant var;

   DWORD dwVer;
   READDATA( dwVer );

   // version 1 and 2 are pre-2.0 and are not backward compatible.  Ignore this data.
   if ( dwVer < 3 )
   {
      return S_FALSE;
   }

   READDATA( m_bColorSyntax );
   READDATA( m_bAllowHSplit );
   READDATA( m_bAllowVSplit );
   READDATA( m_bHScroll );
   READDATA( m_bVScroll );
   READDATA( m_bSmoothScroll );
   READDATA( m_bLineToolTips );
   READDATA( m_bShowLeftMargin );
   READDATA( m_bAllowColumnSel );
   READDATA( m_bAllowDragDrop );
   READDATA( m_bExpandTabs );
   READDATA( m_xPosHSplitter );
   READDATA( m_yPosVSplitter );
   READDATA( m_eIndentStyle );
   READDATA( m_nTabSize );
   READDATA( m_Colors );
   READDATA( m_lf );

   // dealloc old strings
   FreeStrings();

   if ( SUCCEEDED( hr = var.ReadFromStream( pStm ) ) )
   {
       m_bstrText = var.bstrVal;
       var.bstrVal = NULL;
       var.vt = VT_EMPTY;
   }
   else
      goto bail;

   if ( SUCCEEDED( hr = var.ReadFromStream( pStm ) ) )
   {
       m_bstrLang = var.bstrVal;
       var.bstrVal = NULL;
       var.vt = VT_EMPTY;
   }
   else
      goto bail;

   READDATA( m_bDisplayWhitespace );
   READDATA( m_bWantCarriageReturn );
   READDATA( m_bEnabled );
   READDATA( m_bGlobalProps );
   READDATA( m_bModified );
   READDATA( m_bOverType );
   READDATA( m_bReadOnly );
   READDATA( m_bPreserveCase );
   READDATA( m_bCaseSensitiveSearch );
   READDATA( m_bWholeWordOnly );
   READDATA( m_nMaxUndo );
   READDATA( m_bSelBounds );
   READDATA( m_bRegExp );
   READDATA( m_FontStyles );
   READDATA( m_LineNum );
   READDATA( m_bHideSel );
   READDATA( m_bNormalizeCase );
   READDATA( m_bOvertypeCaret );
   READDATA( m_nHighlightedLine );

   if ( dwVer < 4 )
      goto bail;

   READDATA( m_dwBorderStyle );

   if ( dwVer < 5 )
      goto bail;

   READDATA( m_bStealKeys );

   bail:

   return hr;
}
开发者ID:DeegC,项目名称:ZeidonTools,代码行数:87,代码来源:ctlstate.cpp

示例9: OnWebCallback

BOOL CPeraPDWeb::OnWebCallback( int nCode, WEBCALLBACK_METHOD_PARAM_MAP& mapParams
	, CComVariant& varResult )
{
	varResult.Clear();

	CString str;
	WEBCALLBACK_METHOD_PARAM_MAP::iterator itrParam = mapParams.begin();

	switch (nCode)
	{
		//////////////////////////////////////////////////////////////////////////
		//更新结构树
	case WCB_RUNFLOW_COMPLETED:
		{
			if (mapParams.size() != 1)
			{
				//varResult = "参数个数不正确";
				//lc,国际化乱码问题
				varResult = _bstr_t("参数个数不正确").GetBSTR();
				return FALSE;
			}

			itrParam = mapParams.begin();
			//str = itrParam->second.bstrVal;
			//lc,国际化乱码问题
			str = (LPCTSTR)_bstr_t(itrParam->second.bstrVal);

			ZTools::WriteZToolsFormatLog("CPeraPDWeb::OnWebCallback svg通知运行结束 %s\r\n", str );

			if ( g_aw.m_nExeFlag == WEBTYPE_RUNFLOW )
			{
				CWERunFlowCompleted runFlowCompleted;
				if( !runFlowCompleted.ParseData( str ) )
				{
					ZTools::WriteZToolsLog( "CPeraPDWeb::OnWebCallback svg WCB_RUNFLOW_COMPLETED 解析失败" );
				}
				runFlowCompleted.m_dwWebType = WEBTYPE_RUNFLOW;
				runFlowCompleted.m_dwWebEvent = WE_RUNFLOW_COMPLETED;
				runFlowCompleted.m_sWebId = g_aw.m_sId;
				theCommClient.Send( g_aw.m_hHostWnd, &runFlowCompleted );
				ZTools::WriteZToolsLog( "CPeraPDWeb::OnWebCallback svg WCB_RUNFLOW_COMPLETED 发送完成" );
			}
			else
			{
				ZTools::WriteZToolsLog( "CPeraPDWeb::OnWebCallback svg WCB_RUNFLOW_COMPLETED webtype 不匹配" );
			}
		}
		break;
	//////////////////////////////////////////////////////////////////////////
	case WCB_WEB_LOADED:
		{
			ZTools::WriteZToolsFormatLog("WebPage CPeraPDWeb::OnWebCallback %s\r\n", "WCB_WEB_LOADED");

			if ( IsWindow( g_aw.m_hHostWnd )  )
			{
				if ( g_aw.m_nExeFlag == WEBTYPE_RUNPROCESS || g_aw.m_nExeFlag == WEBTYPE_RUNFLOW )
				{
					::PostMessage( g_aw.m_hHostWnd, WM_WEB_LOADED, 0, 0 );
				}
				else
				{
					ZTools::WriteZToolsLog( "WebPage CPeraPDWeb::OnWebCallback WCB_WEB_LOADED webtype 不匹配" );
				}
			}
		}
		break;

		//////////////////////////////////////////////////////////////////////////
	default:
		return FALSE;
	}

	return TRUE;
}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:74,代码来源:PeraPDWeb.cpp

示例10: l

STDMETHODIMP CBDictionary::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
		VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
	if((dispIdMember & 0xff000000) != 0x65000000)
		return CBDispatch<IVariantDictionary>::g_typeinfo.Invoke((IVariantDictionary*)this, dispIdMember, wFlags,
			pDispParams, pVarResult, pExcepInfo, puArgErr);

	dispIdMember &= 0xffffff;

	CBLock l(&m_cs);

	if(dispIdMember < (int)m_posArray.GetCount())
	{
		if((wFlags & (DISPATCH_PROPERTYPUT | DISPATCH_PROPERTYPUTREF)) && pDispParams->cArgs == 1)
		{
			VARIANT* pvar = pDispParams->rgvarg;

			while(pvar->vt == (VT_VARIANT | VT_BYREF))
				pvar = pvar->pvarVal;

			if(!(wFlags & DISPATCH_PROPERTYPUTREF) &&
				(pvar->vt == VT_UNKNOWN || pvar->vt == VT_DISPATCH))
			{
				l.Unlock();

				if(pvar->punkVal == NULL)
					return DISP_E_UNKNOWNINTERFACE;

				CBDispatchPtr pDisp;
				CComVariant var;

				HRESULT hr = pvar->punkVal->QueryInterface(&pDisp);
				if(FAILED(hr))return hr;

				hr = pDisp.GetProperty(0, &var);
				if(FAILED(hr))return hr;

				l.Lock();
				if(dispIdMember < (int)m_posArray.GetCount())
				{
					var.Detach(&m_posArray[dispIdMember]->m_value);
					return S_OK;
				}else return DISP_E_MEMBERNOTFOUND;
			}else return VariantCopyInd(&m_posArray[dispIdMember]->m_value, pvar);
		}else if(pDispParams->cArgs == 0)
		{
			if(pVarResult != NULL)
				return VariantCopy(pVarResult, &m_posArray[dispIdMember]->m_value);

			return S_OK;
		}

		VARIANT *pvar = &m_posArray[dispIdMember]->m_value;

		if(pvar->vt == VT_UNKNOWN || pvar->vt == VT_DISPATCH)
		{
			CBDispatchPtr pDisp;

			HRESULT hr = pvar->punkVal->QueryInterface(&pDisp);
			if(FAILED(hr))
				return DISP_E_BADPARAMCOUNT;

			l.Unlock();
			return pDisp->Invoke(0, riid, lcid, wFlags, pDispParams,
					pVarResult, pExcepInfo, puArgErr);
		}

		return DISP_E_BADPARAMCOUNT;
	}else return DISP_E_MEMBERNOTFOUND;

	return S_OK;
}
开发者ID:2Quico,项目名称:netbox,代码行数:72,代码来源:BDictionary.cpp

示例11: AFX_MANAGE_STATE

STDMETHODIMP CFoundationExemplars::TMchCreateAndDispenseObject()
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())
	VWTRACE(m_pWorld, "VWFOUND", VWT_ERROR, "CFoundationExemplars::TMchCreateAndDispenseObject\n");

	CComPtr<IThing>				pThis;
	CComPtr<IThing>				pUser;
	CComPtr<IThing>				pNewObject;
	CComPtr<IPropertyList>		pItemList;
	CComPtr<IVWTransactionItem>	pCurItem;
	CComPtr<IPropertyMap>		pPropertyValues;
	CComBSTR					bstrName;
	CComBSTR					bstrDescription;
	CComBSTR					bstrGraphic;
	CComBSTR					bstrExemplarType;
	CComVariant					varReturnVal;
	CComVariant					varPropertyValue;
	BSTR						bstrPropertyName;
	VARIANT_BOOL				bLastValue;
	VARIANT_BOOL				bIsEmpty;
	VARIANT_BOOL				bIsValid;
	short						nCurIndex;
    HRESULT                     hr;

	if (FAILED(hr = m_pWorld->get_This(&pThis)))
		goto ERROR_ENCOUNTERED;
	if (FAILED(hr = m_pWorld->get_User(&pUser)))
		goto ERROR_ENCOUNTERED;

	if ((pThis)&&(pUser))
	{
		if (FAILED(hr = pThis->get_Short(CComBSTR("CurrentIndex"), &nCurIndex)))
    		goto ERROR_ENCOUNTERED;
		if (FAILED(hr = pThis->get_ObjectProperty(CComBSTR("ItemList"), (IObjectProperty**) &pItemList)))
	    	goto ERROR_ENCOUNTERED;
		if (pItemList)
		{
			if (FAILED(hr = pItemList->get_ObjectProperty(nCurIndex, (IObjectProperty**) &pCurItem)))
		        goto ERROR_ENCOUNTERED;
			if (pCurItem)
			{
				if (FAILED(hr = pCurItem->get_Name(&bstrName.m_str)))
		            goto ERROR_ENCOUNTERED;
				if (FAILED(hr = pCurItem->get_Description(&bstrDescription.m_str)))
		            goto ERROR_ENCOUNTERED;
				if (FAILED(hr = pCurItem->get_Graphic(&bstrGraphic.m_str)))
		            goto ERROR_ENCOUNTERED;
				if (FAILED(hr = pCurItem->get_ExemplarType(&bstrExemplarType.m_str)))
		            goto ERROR_ENCOUNTERED;
				if (FAILED(hr = pCurItem->get_PropertyValues(&pPropertyValues)))
		            goto ERROR_ENCOUNTERED;

				// Now, create new object
				if (FAILED(hr = m_pWorld->CreateInstanceExt(bstrName, CComVariant(bstrExemplarType), NULL, &pNewObject)))
		            goto ERROR_ENCOUNTERED;
				
				// Set new object's properties
				if (pNewObject)
				{
					CComVariant varFile(bstrGraphic);
					CComDISPPARAMS dpInitGraphics(10, varFile, 
					CComVariant(0.0f), CComVariant(0.45f), CComVariant(0.0f),
					CComVariant(0.0f), CComVariant(0.0f), CComVariant(1.0f),
					CComVariant(0.25f), CComVariant(0.25f), CComVariant(0.25f));
					VARIANT_BOOL	bIsArtifact;
					VARIANT_BOOL	bIsAccessory;

#ifdef _DEBUG
					CComPtr<IThing> pOwner, pCaller;
					CComBSTR bstrOwnerName, bstrCallerName;
					if (FAILED(hr = pNewObject->get_Owner(&pOwner)))
		                goto ERROR_ENCOUNTERED;
					if (pOwner)
                    {
						if (FAILED(hr = pOwner->get_Name(&bstrOwnerName.m_str)))
		                    goto ERROR_ENCOUNTERED;
                    }
					if (FAILED(hr = m_pWorld->get_Caller(&pCaller)))
		                goto ERROR_ENCOUNTERED;
					if (pCaller)
                    {
						if (FAILED(hr = pCaller->get_Name(&bstrCallerName.m_str)))
		                    goto ERROR_ENCOUNTERED;
                    }
#endif

				    if (FAILED(hr = pNewObject->InvokeMethodExt(CComBSTR("InitializeSpriteGraphics"), (DISPPARAMS *) dpInitGraphics, NULL)))
		                goto ERROR_ENCOUNTERED;
					if (FAILED(hr = pNewObject->put_Description(bstrDescription)))
		                goto ERROR_ENCOUNTERED;
					if (FAILED(hr = pNewObject->put_BOOL(CComBSTR("IsTakeable"), VARIANT_TRUE)))
		                goto ERROR_ENCOUNTERED;

					// Set additional properties if specified in PropertyValue propertymap
					if (FAILED(hr = pPropertyValues->get_IsEmpty(&bIsEmpty)))
		                goto ERROR_ENCOUNTERED;						
					if (bIsEmpty!=VARIANT_TRUE)
					{
						// Get first pair of values 
						if (FAILED(hr = pPropertyValues->FirstItem(&bstrPropertyName, &varPropertyValue, &bLastValue)))
//.........这里部分代码省略.........
开发者ID:opensim4opencog,项目名称:PrologVirtualWorlds,代码行数:101,代码来源:transmch.cpp

示例12: GetModuleFileName

//
// AdaptorInfo
//
// Description:
//  Invoked by MatLab function daqhwinfo('cbi'). The function
//  is used to extract relavent info about the current HW
//  configuration. Need to get the board names, the board number
//  and what subsystems are supported, AnalogInput, AnalogOutput,
//  and DigitalIO.
//
// UL Routines:
//  cbGetConfig()
//  cbGetBoardName()
//
HRESULT CbDevice::AdaptorInfo(IPropContainer * Container)
{
    int i = 0;          // Index variable
    wchar_t str[40];    // Temp variable for BoardName

    // Place the adaptor name, 'cbi', in the appropriate struct in the engine.
    HRESULT hRes = Container->put_MemberValue(CComBSTR(L"adaptorname"),CComVariant(L"mcc"));
    if (!(SUCCEEDED(hRes))) return hRes;

    TCHAR name[256];
    GetModuleFileName(_Module.GetModuleInstance(),name,256); // null returns MATLABs version (non existant)

    hRes = Container->put_MemberValue(CComBSTR(L"adaptordllname"),CComVariant(name));
    if (!(SUCCEEDED(hRes))) return hRes;

    // First determine the number of boards installed.
    short idVec[16]={0};        // List of board Numbers
    short len=0;                  // Number of boards installed

    // Return a list of board numbers and number of installed boards. 
    GetInstalledBoardInfo(idVec,&len);      

    SAFEARRAY *boardids = SafeArrayCreateVector(VT_BSTR, 0, len);
    if (boardids==NULL) 
        return E_OUTOFMEMORY;
    
    CComBSTR *stringids=NULL;
    CComVariant bids;   
    
    bids.parray=boardids;
    bids.vt = VT_ARRAY | VT_BSTR;           
    
    hRes = SafeArrayAccessData(boardids, (void **) &stringids);
    if (FAILED (hRes)) {
        SafeArrayDestroy (boardids);
        return hRes;
    }

    for (i=0;i<len;i++) {	
		swprintf(str,L"%d",(int)idVec[i]);
		stringids[i] = str;
    }  

    SafeArrayUnaccessData(boardids);
    
    // Return the board numbers to the 'engine'
    hRes = Container->put_MemberValue(CComBSTR(L"installedboardids"),bids);   
    if (!(SUCCEEDED(hRes))) return hRes;    

    bids.Clear();

    // build up an array of device names
    CComVariant val;    
    CComBSTR *strings;
    
    SAFEARRAY *ps = SafeArrayCreateVector(VT_BSTR, 0, len);
    if (ps==NULL) 
        return E_OUTOFMEMORY;

    val.parray=ps;
    val.vt = VT_ARRAY | VT_BSTR;

    HRESULT hr = SafeArrayAccessData(ps, (void **) &strings);
    if (FAILED (hr)) 
    {
        SafeArrayDestroy (ps);
        return hr;
    }             

    
    char bName[BOARDNAMELEN];

    for (i=0;i<len;i++)
    {
        if (!cbGetBoardName(idVec[i], bName))
            strings[i] = CComBSTR(bName);
    }
                        

    hRes = Container->put_MemberValue(CComBSTR(L"boardnames"),val);
    if (!(SUCCEEDED(hRes))) return hRes;

    SafeArrayUnaccessData(ps);

    // up to 3 subsystems per board
    CComBSTR *subsystems;
//.........这里部分代码省略.........
开发者ID:motor,项目名称:clock_stimulus,代码行数:101,代码来源:cbUtil.cpp

示例13: CopyVersion2Constructs

HRESULT CAzAppGroup::Copy(CAzAppGroup &srcAppGroup) {

    CAzLogging::Entering(_TEXT("Copy"));

    CComBSTR bstrData;

    CComVariant cVVar;

    LONG lType;


    HRESULT hr=srcAppGroup.m_native->get_Description(&bstrData);

    CAzLogging::Log(hr,_TEXT("Getting Description for App Group"),COLE2T(srcAppGroup.getName()));

    if (SUCCEEDED(hr)) {

        hr=m_native->put_Description(bstrData);

        CAzLogging::Log(hr,_TEXT("Setting Description for App Group"),COLE2T(getName()));

        bstrData.Empty();
    }

    hr=srcAppGroup.m_native->get_Type(&lType);

    CAzLogging::Log(hr,_TEXT("Getting Type for App Group"),COLE2T(srcAppGroup.getName()));

    if (SUCCEEDED(hr)) {

        hr=m_native->put_Type(lType);

        CAzLogging::Log(hr,_TEXT("Setting Type for App Group"),COLE2T(getName()));

    }


    hr=srcAppGroup.m_native->get_LdapQuery(&bstrData);

    CAzLogging::Log(hr,_TEXT("Getting LDAPQuery for App Group"),COLE2T(srcAppGroup.getName()));

    // THe length check is reqd below as adding an empty string
    // LDAP Query returns an error

    if (SUCCEEDED(hr) && bstrData.Length()!=0) {

        hr=m_native->put_LdapQuery(bstrData);

        CAzLogging::Log(hr,_TEXT("Setting LDAPQuery for App Group"),COLE2T(getName()));

        bstrData.Empty();
    }

    if (CAzGlobalOptions::m_bVersionTwo) {

            hr = CopyVersion2Constructs(srcAppGroup);

            CAzLogging::Log(hr,_TEXT("Copying bizrule properties for App Group"),COLE2T(srcAppGroup.getName()));
    }

    if (!CAzGlobalOptions::m_bIgnoreMembers) {

        hr=srcAppGroup.m_native->get_Members(&cVVar);

        CAzLogging::Log(hr,_TEXT("Getting Members for App Group"),COLE2T(srcAppGroup.getName()));

        if (SUCCEEDED(hr)) {

            hr=InitializeUsingSafeArray(cVVar,&IAzApplicationGroup::AddMember);

            CAzLogging::Log(hr,_TEXT("Setting Members for App Group"),COLE2T(getName()));

            cVVar.Clear();
        }

        hr=srcAppGroup.m_native->get_NonMembers(&cVVar);

        CAzLogging::Log(hr,_TEXT("Getting Non Members for App Group"),COLE2T(srcAppGroup.getName()));

        if (SUCCEEDED(hr)) {

            hr=InitializeUsingSafeArray(cVVar,&IAzApplicationGroup::AddNonMember );

            CAzLogging::Log(hr,_TEXT("Setting Non Members for App Group"),COLE2T(getName()));

            cVVar.Clear();
        }
    }

    hr=m_native->Submit(0,CComVariant());

    CAzLogging::Log(hr,_TEXT("Submitting App Group"),COLE2T(getName()));

    CAzLogging::Exiting(_TEXT("Copy"));

    return hr;
}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:97,代码来源:AzAppGroup.cpp

示例14: _tmain


//.........这里部分代码省略.........
			BSTR bstrValue = var.bstrVal;
		}
		else if (var.vt == VT_BOOL)
		{
			VARIANT_BOOL varbValue = var.boolVal;
		}

		VariantClear(&var);
	}

	//COM数据类型的转换,LONG转成FLOAT
	{
		VARIANT var;
		VariantInit(&var);

		var.vt = VT_I4;
		var.lVal = 100;

		VariantChangeType(&var,&var,0, VT_R4);

		if (var.vt == VT_R4)
		{
			FLOAT fValue = var.fltVal;
		}

		VariantClear(&var);
	}

	//COM数据类型的转换,LONG转成BSTR
	{
		VARIANT var;
		VariantInit(&var);

		var.vt = VT_I4;
		var.lVal = 100;

		VariantChangeType(&var,&var,0, VT_BSTR);

		if (var.vt == VT_BSTR)
		{
			BSTR fValue = var.bstrVal;
		}

		VariantClear(&var);
	}

	//CComVariant的构造方法
	{
		VARIANT varA;
		CComVariant varB;
		CComVariant varC(varA);
		CComVariant varD(varB);
		CComVariant varE(L"Hello CComVariant");
		CComVariant varF("CComVariant");
		CComVariant varG(true);
		CComVariant varH(100L);
		CComVariant varI(1.23f);
		//....

	}

	//CComVariant的赋值方法
	{
		VARIANT varA;
		CComVariant varB;
		CComVariant varC;
		varC = varA;
		varC = varB;
		varC = true;
		varC = 100L;
		varC = 1.23f;
		varC = L"Hello CComVariant";
		varC = "Hello CComVariant";
		//....
	}

	//CComVariant与VARIANT的关联
	{
		VARIANT varA;
		VariantInit(&varA);
		varA.vt = VT_I4;
		varA.lVal = 100;
		
		CComVariant varB;

		CComVariant varC(100L);
		
		VARIANT varD;
		VariantInit(&varD);

		//Attach
		varB.Attach(&varA);		//之后无需调用VariantClear(&varA);

		//Detach
		varC.Detach(&varD);
		VariantClear(&varD);	//需要调用VariantClear(&varD);
	}

	return 0;
}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:101,代码来源:Section3Demo1.cpp

示例15: LoadDATAUrl

void CGPAXPlugin::LoadDATAUrl()
{
#ifndef _WIN32_WCE
	HRESULT hr;

	if (m_url[0]) return;
    /*get parent doc*/
	CComPtr<IOleContainer> spContainer;
	if (m_spClientSite->GetContainer(&spContainer) != S_OK)
		return;
    CComPtr<IHTMLDocument2> spDoc = CComQIPtr<IHTMLDocument2>(spContainer);
    CComPtr<IHTMLElementCollection> spColl;
	if (spDoc->get_all(&spColl) != S_OK)
		return;
	/*get HTML <object> in the doc*/
    CComPtr<IDispatch> spDisp;
	CComPtr<IHTMLElementCollection> sphtmlObjects;

    CComPtr<IDispatch> spDispObjects;
	if (spColl->tags(CComVariant("OBJECT"), &spDispObjects) != S_OK)
		return;
    CComPtr<IHTMLElementCollection> spObjs = CComQIPtr<IHTMLElementCollection>(spDispObjects);
	
	/*browse all objects and find us*/
	long lCount = 0;
	spObjs->get_length(&lCount);
	for (long lCnt = 0; lCnt < lCount; lCnt++) {   
		IDispatch *an_obj= NULL;
		CComVariant varEmpty;
		CComVariant varName;
		varName.vt = VT_I4;
		varName.lVal = lCnt;
		hr = spObjs->item(varName, varEmpty, &an_obj);
		varName.Clear();
		varEmpty.Clear();
		if (hr != S_OK) continue;

		/*get the IHTMLObject*/
		IHTMLObjectElement* pObjectElem=NULL;
		an_obj->QueryInterface(IID_IHTMLObjectElement, (void**)&pObjectElem);
		if (!pObjectElem) continue;

		/*get its parent owner - it MUST be us*/
		IDispatch *disp= NULL;
		pObjectElem->get_object(&disp);
		if (disp != this) continue;

		BSTR data = NULL;
		if ((pObjectElem->get_data(&data) == S_OK) && data) {
			const u16 *srcp = (const u16 *) data;
			u32 len = gf_utf8_wcstombs(m_url, MAXLEN_URL, &srcp);
			if (len>=0) m_url[len] = 0;
		}
		SysFreeString(data);
		break;
	}

	if (m_url) {
		UpdateURL();
	}
#endif

}
开发者ID:bigbensk,项目名称:gpac,代码行数:63,代码来源:GPAXPlugin.cpp


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