Пример #1
0
//-----------------------------------------------------------------------------
// Name: InitFail()
// Desc: This function is called if an initialization function fails
//-----------------------------------------------------------------------------
HRESULT
InitFail(HWND hWnd, HRESULT hRet, LPCTSTR szError,...)
{
    ReleaseAllObjects();
    DestroyWindow(hWnd);
    g_szErrorMessage = szError;
    return hRet;
}
Пример #2
0
//-----------------------------------------------------------------------------
// Name: RptError()
// Desc: 
//-----------------------------------------------------------------------------
HRESULT
COpenGL::RptError( HWND hWnd, HRESULT hRet, LPCTSTR szError, ... )
{
    char                        szBuff[128];
    va_list                     vl;
    
    va_start( vl, szError );
    vsprintf_s( szBuff, szError, vl );
    ReleaseAllObjects();
    MessageBox( hWnd, szBuff, "Oscilloscopes", MB_OK | MB_ICONHAND );
    va_end( vl );
    return hRet;
}
Пример #3
0
void mfc_render_final()
{
	ReleaseAllObjects();
}
Пример #4
0
//-----------------------------------------------------------------------------
// Name: ~COpenGL()
// Desc: 
//-----------------------------------------------------------------------------
COpenGL::~COpenGL()
{
	ReleaseAllObjects();
}
Пример #5
0
//
// WriteTo
//
AAFRESULT STDMETHODCALLTYPE ImplAAFRefArrayValue::WriteTo(
  OMProperty* pOmProp)
{
  AAFRESULT result = AAFRESULT_SUCCESS;
  OMObject* object;
  ImplAAFStorable* obj;
  if (NULL == property())
  {
    // First empty the current property.
    OMContainerProperty * pNewContainerProperty = dynamic_cast<OMContainerProperty *>(pOmProp);
    if (NULL == pNewContainerProperty)
      return AAFRESULT_INVALID_OBJ;
    OMReferenceContainer *pNewReferenceContainer = pNewContainerProperty->referenceContainer();
    if (NULL == pNewReferenceContainer)
      return AAFRESULT_INVALID_OBJ;
    
    if (usesReferenceCounting())
    {
      result = ReleaseAllObjects(pNewReferenceContainer);
      if (AAFRESULT_FAILED(result))
        return result;
    }
      
    // Make sure that there are no elements in the new property container.
    pNewReferenceContainer->removeAllObjects();
    
    // Install the new "empty" container property.
    SetProperty(pOmProp);

    OMReferenceContainerIterator* tempIterator = _tempStorableVector->createIterator();
    if (NULL == tempIterator)
    {
      result = AAFRESULT_NOMEMORY;
    }
    else
    {
      while (AAFRESULT_SUCCEEDED(result) && (tempIterator->before() || tempIterator->valid()))
      {
        if (++(*tempIterator))
        {
          object = tempIterator->currentObject();
          obj = dynamic_cast<ImplAAFStorable*>(object);
          ASSERTU(NULL != obj);
          if (NULL == obj)
          {
            result = AAFRESULT_INVALID_OBJ;
          }
          else
          {
//            if (usesReferenceCounting())
//            {
//              obj->detach();
//            }
            
            // Add the element from the temporary property container to the property.
            result = InsertObject(obj); // reference counts if necessary...
            
            if (AAFRESULT_SUCCEEDED(result))
            {
              if (usesReferenceCounting())
              {
                obj->ReleaseReference();
              }
            }
          }
        }
      }
   
      delete tempIterator;
      tempIterator = NULL;
    }
    
    // Cleanup the temporary property now the the the pOmProp has been created and initialized.
		delete _tempStorableVector;
		_tempStorableVector = NULL;
    
    if (AAFRESULT_FAILED(result))
      return result;
  }

  return (ImplAAFRefContainerValue::WriteTo(pOmProp));
}