/**
 * Function name    CDialogGenBase::GetAlias
 * Description      returns the alias for the st object
 * @return          CString
 * @exception       -
 * @see             -
*/
CString CDialogGenBase::GetAlias()
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
	return m_ObjPropGenBase.m_Alias;
}
STDAPI DllCanUnloadNow(void)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
}
/**
 * Function name    SysComment::GetRange
 * Description      returns the range of the system comment
 * @return          const StringPosRange&
 * @exception       -
 * @see             -
*/
const StringPosRange& SysComment::GetRange() const
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

    return m_range;
}
DLL_DECL void *
DesertFinitNoGui(bool noError,bool noGui,const char *applyConstraints)
{
  AFX_MANAGE_STATE(AfxGetStaticModuleState());
  ASSERT_EX( CManager::theInstance, "CoreInit", "CManager::theInstance IS null");
 
  CCSetErrDialog cse_dialog;

  if(!CManager::theInstance->VerifyConstraints(&cse_dialog))
  {
	  delete CManager::theInstance;
	  CManager::theInstance = NULL;
	  throw new CDesertException(cse_dialog.m_strErrCts);
  }

  CManager::theInstance->AnalyseConstraints();
  CManager::theInstance->GenerateNextHierarchy();
  
  void * retval = NULL;
  if (noError)
  {
    if (CManager::theInstance->HasConstraints())
    {
		if (applyConstraints)
		{
			CStringList cNames;
			bool applyAll = strncmp(applyConstraints, "applyAll", 8) == 0;
			if (!applyAll)
			{
				char *cons = strdup(applyConstraints);
				char *cName = strtok( cons, ":" );
				while(cName)
				{
					cNames.AddTail( cName );
					cName = strtok( NULL, ":" );
				}
			}
			CDynConstraintSet *set = new CDynConstraintSet(0);
			set->RemoveAll();
			CDynConstraintSetList & setlist = CManager::theInstance->GetConstraintSets();

			POSITION sl_pos = setlist.GetHeadPosition();
			while (sl_pos)
			{
				CDynConstraintSet * setlist_i = setlist.GetNext(sl_pos);
				CDynConstraintList& list = setlist_i->GetConstraints();
				POSITION pos1 = list.GetHeadPosition();
				while(pos1)
				{
					CDynConstraint *cur = list.GetNext(pos1);
					const CString& nm  = cur->GetName();

					if (applyAll || cNames.Find(nm))
					{
						Info("DesertFinit", "Applying Constraint: %s", nm);
						cur->SetApplied();
						set->InsertConstraint(cur);
					}
				}
			}
			// prune & generate next hierarchy
			double dspSize;
			long repSize;
			long clockTime;
			try{
				CManager::theInstance->GetSizeInfo(dspSize, repSize, clockTime, set);			
			}catch(CDesertException *e)
			{
				CManager::theInstance->GenerateNextHierarchy();
				set->RemoveAll();
				delete set;
				delete CManager::theInstance;
				CManager::theInstance = NULL;
				StopLogging();
				throw e;
			}
			CManager::theInstance->GenerateNextHierarchy();
			Info("DesertFinit", "Design Space Size Info: %f %d %d", dspSize, repSize, clockTime);
			set->RemoveAll();
			delete set;
		}
    }
//	CManager::theInstance->
//#ifdef DO_STORE_CONFIGURATIONS
    // dump the configurations
    CString fname = projectName + ".cfg";
	std::string errmsg;
	try{
		retval = CManager::theInstance->StoreConfigurations(fname, errmsg);
	 }
	catch(CDesertException *e)
	{
		delete CManager::theInstance;
		CManager::theInstance = NULL;
		StopLogging();
		throw e;
	}
//#endif
  }

  // delete the manager instance
  delete CManager::theInstance;
  CManager::theInstance = NULL;

  Info("DesertFinit", "Generated Configurations");

  // stop logging
  StopLogging();
  return retval;
}
Esempio n. 5
0
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	return AfxDllGetClassObject(rclsid, riid, ppv);
}
Esempio n. 6
0
HRESULT CCommands::XApplicationEvents::DocumentSave (IDispatch * theDocument)
{
	AFX_MANAGE_STATE (AfxGetStaticModuleState ());
	return S_OK;
}
Esempio n. 7
0
HRESULT CCommands::XApplicationEvents::NewWorkspace ()
{
	AFX_MANAGE_STATE (AfxGetStaticModuleState ());
	return S_OK;
}
Esempio n. 8
0
CMarkReaderWriter::CMarkReaderWriter()
{
   AFX_MANAGE_STATE(AfxGetStaticModuleState());

   m_aAllMarks.SetSize(0, 160);
}
Esempio n. 9
0
int CMarkReaderWriter::GetCount()
{
   AFX_MANAGE_STATE(AfxGetStaticModuleState());

   return m_aAllMarks.GetSize();
}
/**
 * Function name    Resource::getTarget
 * Description      returns the target for the resource
 * @return          const string&
 * @exception       -
 * @see             -
*/
const string& Resource::getTarget() const
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

    return m_target;
}
Esempio n. 11
0
CStopJumpMark::~CStopJumpMark()
{
   AFX_MANAGE_STATE(AfxGetStaticModuleState());

}
/**
 * Function name    Resource::getPOUType
 * Description      returns the type of the pou
 * @return          string
 * @exception       -
 * @see             -
*/
string Resource::getPOUType() const 
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
    
    return _RESOURCE;
}
/**
 * Function name    Resource::getTargetRange
 * Description      returns the range of the target for the resource
 * @return          const StringPosRange&
 * @exception       -
 * @see             -
*/
const StringPosRange& Resource::getTargetRange() const
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

    return m_target_range;
}
Esempio n. 14
0
BOOL WINAPI StartEnliver()
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	return StartEnliverRaw(TRUE);
}
Esempio n. 15
0
HRESULT CCommands::XApplicationEvents::BuildFinish (long nNumErrors, long nNumWarnings)
{
	AFX_MANAGE_STATE (AfxGetStaticModuleState ());
	return S_OK;
}
Esempio n. 16
0
STDMETHODIMP CPointClass::get_LastErrorCode(long *pVal)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())
	*pVal = tkNO_ERROR;
	return S_OK;
}
Esempio n. 17
0
HRESULT CCommands::XApplicationEvents::BeforeApplicationShutDown ()
{
	AFX_MANAGE_STATE (AfxGetStaticModuleState ());
	return S_OK;
}
Esempio n. 18
0
STDMETHODIMP CPointClass::get_GlobalCallback(ICallback **pVal)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())
	*pVal = NULL;
	return S_OK;
}
Esempio n. 19
0
HRESULT CCommands::XApplicationEvents::WindowDeactivate (IDispatch * theWindow)
{
	AFX_MANAGE_STATE (AfxGetStaticModuleState ());
	return S_OK;
}
BOOL CPolyTool::OnLButtonDown(  UINT nFlags, POINT ptScreen )
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState( ));	

 	HRESULT hr = S_OK;
	BOOL bHandled = FALSE;
	VARIANT_BOOL bSafe = VARIANT_TRUE;
	HWND hWnd;
	VARIANTARG varHitParams,varHitResult;
	BOOL bMakeNewBoundary = TRUE;
	D3DVECTOR vec;

	::VariantInit( &varHitParams );
	::VariantInit( &varHitResult );

	float flX = (float)ptScreen.x;
	float flY = (float)ptScreen.y;
	float flZ = 0.0;

	if(!m_pUIView || !m_pControlManager)
	{
		hr = VWSTUDIO_E_BADCONTROLINITIALIZATION;
		goto EXIT_FAIL;
	}

	if (!m_piEditorViewControl)
	{
		hr = m_pUIView->QueryInterface(DIID__RenderingControl, (LPVOID*) &m_piEditorViewControl);
		if (FAILED(hr) || (m_piEditorViewControl == NULL)) goto EXIT_FAIL;
	}

	hr = m_pUIView->DeviceToWorld( &flX, &flY, &flZ);
	if(FAILED(hr)) goto EXIT_FAIL;

	m_pUIView->get_HWND(&hWnd);

	::SetFocus(hWnd);


	//TRACE("CPolyTool::OnLButtonDown point.x = %d, y = %d, World.x = %7.2f, z = %7.2f\n", ptScreen.x, ptScreen.y, flX, flZ);
	
	// Get selected BoundaryList. Create a new an Boundary, because this is the first point of a new one.
	if(NULL == m_pBoundary)
	{
		varHitParams.vt = VT_POINT_BYREF;
		varHitParams.byref = (LPVOID) &ptScreen;

		hr = ((IVWUIView*)m_pUIView)->HitTest(varHitParams, 0, &varHitResult);	
		if( FAILED(hr)) goto EXIT_FAIL;

		//Attempt a vertex insertion if we clicked on one.
		if(varHitResult.vt != VT_EMPTY)
		{
			int nPickResult;

			nPickResult = TryInsVert(&varHitResult, ptScreen.x, ptScreen.y);

			if (nPickResult == PICKRESULT_POINTUNSAFE || nPickResult == PICKRESULT_INSERTOK || nPickResult == PICKRESULT_PERMISSION_DENIED)
			{
				if (nPickResult != PICKRESULT_INSERTOK)
					MessageBeep(MB_ICONASTERISK);

				bMakeNewBoundary = FALSE;
			}
		}

		if (bMakeNewBoundary)
		{
			//Reset all state just in case
			SAFERELEASE(m_pCurrentThing);
			SAFERELEASE(m_pCurrentThingFrame);
			SAFERELEASE(m_pCurrentBoundaryList);
			SAFERELEASE(m_pBoundary);
			m_cVertices = 0;

			hr = StartNewBoundary( &m_pBoundary );
			if( FAILED(hr) || !m_pBoundary)
			{
				MessageBeep(MB_ICONASTERISK);
				goto EXIT_FAIL; 
			}

			m_nFirstVertexX = ptScreen.x;
			m_nFirstVertexY = ptScreen.y;

			// Assume we fail.
			m_fLastVertexLegal = FALSE;

			// Insert first vertex offset by Thing's position
			//hr = m_2DThingXform.TransformToThingCoords( &flX, &flY, &flZ);
			//if(FAILED(hr)) goto EXIT_FAIL;

			vec.x = flX;
			vec.y = flY;
			vec.z = flZ;

			m_pCurrentThingFrame->InverseTransform(AXIS_Y, &vec.x, &vec.y, &vec.z, vec.x, vec.y, vec.z);

			hr = m_pBoundary->InsertVertex(-1, vec.x, vec.z);
			if( FAILED(hr) ) goto EXIT_FAIL;

			//Start with 2 vertices the same, boundaries require at least 2.
			hr = m_pBoundary->InsertVertex(-1, vec.x + (float)0.001 , vec.z);
			if( FAILED(hr) ) goto EXIT_FAIL;

			// The second vert will be moved to the second vertex position.
			m_cVertices = 1;
			m_flLastX = vec.x;
			m_flLastZ = vec.z;

			// Add single Boundary to BoundaryList.
			hr = m_pCurrentBoundaryList->Add( CComVariant(m_pBoundary) );
 			if( FAILED(hr) ) goto EXIT_FAIL;

			//InvokeToolEvent(TOOLEVENT_BOUNDARYUPDATE, m_pBoundary, NULL, NULL, NULL, VARIANT_FALSE);
		}
	}  
	else // Add a Vertex to existing Boundary
	{
		//If we're near the first vertex, we're done with the boundary.
		if ( abs(m_nFirstVertexX - ptScreen.x) < 5 &&
		     abs(m_nFirstVertexY - ptScreen.y) < 5 )
		{
			ClosePolygon(nFlags, ptScreen);
		}
		else
		{
			// Assume we fail.
			m_fLastVertexLegal = FALSE;

			vec.x = flX;
			vec.y = flY;
			vec.z = flZ;

			m_pCurrentThingFrame->InverseTransform(AXIS_Y, &vec.x, &vec.y, &vec.z, vec.x, vec.y, vec.z);

//			hr = m_2DThingXform.TransformToThingCoords( &flX, &flY, &flZ);
//			if(FAILED(hr)) goto EXIT_FAIL;

			if( (m_flLastX != flX) && (m_flLastZ != flZ) )
			{
				if( 1 == m_cVertices )
				{
//					float fTmpX, fTmpZ;
//					hr = m_pBoundary->GetVertexXYExt(1, &fTmpX, &fTmpZ);
//					if( FAILED(hr) ) goto EXIT_FAIL;
//
//					// Move the second vert, which was added to satisfy the Boundary.
//					hr = m_pBoundary->TranslateVertexSafe(1, flX - fTmpX, flZ - fTmpZ, &bSafe);
//					if( FAILED(hr) ) goto EXIT_FAIL;

					hr = m_pBoundary->SetVertexXY(1, vec.x, vec.z);
					if( FAILED(hr) ) goto EXIT_FAIL;

					bSafe = TRUE;
				}
				else
				{
					// Insert the next point into the BoundaryBuilder
					hr = m_pBoundary->InsertVertexSafe(-1, vec.x, vec.z, &bSafe );
					if( FAILED(hr) ) goto EXIT_FAIL;
				}

				if (bSafe)
				{
					m_flLastX = vec.x;
					m_flLastZ = vec.z;
					m_cVertices++;
				}

				InvokeToolEvent(TOOLEVENT_BOUNDARYUPDATE, m_pBoundary, bstrNULL, bstrNULL, bstrNULL, VARIANT_FALSE);
			}
		}
	}

	// Set this to signal OnLButtonDblClk that last vertex was good.
	m_fLastVertexLegal = TRUE;

	goto EXIT_SUCCEEDED;

EXIT_FAIL:
	SAFERELEASE(m_pCurrentThing);
	SAFERELEASE(m_pCurrentBoundaryList);
	SAFERELEASE(m_pCurrentThingFrame);
	SAFERELEASE(m_pBoundary);

	m_cVertices = 0;

	//MessageBeep(-1);

EXIT_SUCCEEDED:
	::VariantClear( &varHitParams );
	::VariantClear( &varHitResult );
	if (S_OK == hr)
		bHandled = TRUE;

	return bHandled;
}
Esempio n. 21
0
HRESULT CCommands::XDebuggerEvents::BreakpointHit (IDispatch * pBreakpoint)
{
	AFX_MANAGE_STATE (AfxGetStaticModuleState ());
	return S_OK;
}
Esempio n. 22
0
/////////////////////////////////////////////////////////////////////////////
//++
//
//  CBasePropertyPage::HrInit
//
//  Description:
//      Initialize the page.
//
//  Arguments:
//      peoInout
//          Pointer to the extension object.
//
//  Return Value:
//      S_OK
//          Page initialized successfully.
//
//      Other HRESULTs
//          Page failed to initialize.
//
//--
/////////////////////////////////////////////////////////////////////////////
HRESULT
CBasePropertyPage::HrInit(
    CExtObject * peoInout
    )
{
    ASSERT( peoInout != NULL );

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    HRESULT         hr = S_OK;
    CWaitCursor     wc;
    DWORD           sc = ERROR_SUCCESS;
    CClusPropList   cpl;

    m_peo = peoInout;

    //
    //  Don't display a help button.
    //

    m_psp.dwFlags &= ~PSP_HASHELP;

    //
    //  Construct the property page.
    //

    if ( Peo()->BWizard() )
    {
        ASSERT( IddWizardPage() != NULL);
        Construct( IddWizardPage(), IdsCaption() );
    } // if: adding page to wizard
    else
    {
        ASSERT( IddPropertyPage() != NULL );
        Construct( IddPropertyPage(), IdsCaption() );
    } // else: adding page to property sheet

    //
    //  Read the properties private to this resource and parse them.
    //

    ASSERT( Peo() != NULL );
    ASSERT( Peo()->PodObjData() );

    //
    //  Read the properties.
    //

    switch ( Cot() )
    {
        case CLUADMEX_OT_CLUSTER:
        {
            CClusterData * pccd = reinterpret_cast< CClusterData * >( Peo()->PodObjData() );
            ASSERT( pccd && (pccd->GetHCluster() != NULL) );
            sc = cpl.ScGetClusterProperties(
                                      pccd->GetHCluster()
                                    , CLUSCTL_CLUSTER_GET_PRIVATE_PROPERTIES
                                    );
            break;
        }
        case CLUADMEX_OT_NODE:
        {
            CNodeData * pcnd = reinterpret_cast< CNodeData * >( Peo()->PodObjData() );
            ASSERT( pcnd && (pcnd->GetHNode() != NULL) );
            sc = cpl.ScGetNodeProperties(
                                      pcnd->GetHNode()
                                    , CLUSCTL_NODE_GET_PRIVATE_PROPERTIES
                                    );
            break;
        }
        case CLUADMEX_OT_GROUP:
        {
            CGroupData * pcgd = reinterpret_cast< CGroupData * >( Peo()->PodObjData() );
            ASSERT( pcgd && (pcgd->GetHGroup() != NULL) );
            sc = cpl.ScGetGroupProperties(
                                      pcgd->GetHGroup()
                                    , CLUSCTL_GROUP_GET_PRIVATE_PROPERTIES
                                    );
            break;
        }
        case CLUADMEX_OT_RESOURCE:
        {
            CResData * pcrd = reinterpret_cast< CResData * >( Peo()->PodObjData() );
            ASSERT( pcrd && (pcrd->GetHResource() != NULL) );
            sc = cpl.ScGetResourceProperties(
                                      pcrd->GetHResource()
                                    , CLUSCTL_RESOURCE_GET_PRIVATE_PROPERTIES
                                    );
            break;
        }
        case CLUADMEX_OT_RESOURCETYPE:
        {
            CResTypeData * pcrd = reinterpret_cast< CResTypeData * >( Peo()->PodObjData() );
            ASSERT( pcrd && (pcrd->StrName().GetLength() > 0) );
            sc = cpl.ScGetResourceTypeProperties(
                                      Hcluster()
                                    , pcrd->StrName()
                                    , CLUSCTL_RESOURCE_TYPE_GET_PRIVATE_PROPERTIES
                                    );
            break;
        }
        case CLUADMEX_OT_NETWORK:
        {
            CNetworkData * pcnd = reinterpret_cast< CNetworkData * >( Peo()->PodObjData() );
            ASSERT( pcnd && (pcnd->GetHNetwork() != NULL) );
            sc = cpl.ScGetNetworkProperties(
                                      pcnd->GetHNetwork()
                                    , CLUSCTL_NETWORK_GET_PRIVATE_PROPERTIES
                                    );
            break;
        }
        case CLUADMEX_OT_NETINTERFACE:
        {
            CNetInterfaceData * pcnd = reinterpret_cast< CNetInterfaceData * >( Peo()->PodObjData() );
            ASSERT( pcnd && (pcnd->GetHNetInterface() != NULL) );
            sc = cpl.ScGetNetInterfaceProperties(
                                      pcnd->GetHNetInterface()
                                    , CLUSCTL_NETINTERFACE_GET_PRIVATE_PROPERTIES
                                    );
            break;
        }
        default:
            ASSERT( 0 );
    } // switch: object type

    //
    //  Parse the properties.
    //

    if ( sc == ERROR_SUCCESS )
    {
        // Parse the properties.
        try
        {
            sc = ScParseProperties( cpl );
        } // try
        catch ( CMemoryException * pme )
        {
            hr = E_OUTOFMEMORY;
            pme->Delete();
        } // catch: CMemoryException
    } // if: properties read successfully

    if ( sc != ERROR_SUCCESS )
    {
        hr = HRESULT_FROM_WIN32( sc );
        goto Cleanup;
    } // if: error parsing getting or parsing properties

Cleanup:

    return hr;

} //*** CBasePropertyPage::HrInit
bool CTestDigitizerPlugIn::EnableDigitizer( bool bEnable )
{
  // In case we need to access our resources...
	AFX_MANAGE_STATE( AfxGetStaticModuleState() ); 

  // In case we need Rhino main window handle...
  HWND hwndRhino = RhinoApp().MainWnd();

	bool rc = false;

	if( bEnable )
	{
    for( ;; )
    {
      if( m_bDigitizerConnected ) 
      {
        ::RhinoApp().Print( L"Digitizer already connected.\n" );
        rc = true;
        break;
      }

      ::RhinoApp().Print( L"Connecting to digitizer ...\n" );

      /*
      Do whatever it takes to connnect to and initialize
      your digitizer here. If you need to call LoadLibrary()
      to load some communication DLL, do it here. Once you 
      have connected and initialized your digitizer, you can
      create the polling thread.
      */

      // Start up the polling thread
      m_hThread = ::CreateThread( NULL, 0, ThreadProc, this, 0, &m_dwThreadID );
      m_bDigitizerConnected = true;
      rc = true;
      break;
    }
  }
  else 
  {
    if( !m_bDigitizerConnected )
      return true;
  
    if( m_hThread ) 
    {
      ::TerminateThread( m_hThread, 0 );
      ::CloseHandle( m_hThread );
      m_hThread = 0;
    }
  
  	/*
    Shut down communications with the digitizer here. If 
    you need to call FreeLibrary to release a communications
    DLL, do it here.
    */

    m_dwThreadID = 0;
    m_bDigitizerConnected = false;
    rc = true;
  }

  return rc;
}
//-------------------------------------------------------------------------------------------------//
// Class:       CHL2LoaderPlugIn
// 
// Function:    Init
// 
// Description: Initializes this particular plug-in
//
//-------------------------------------------------------------------------------------------------//
bool CHL2LoaderPlugIn::Init()
{
   AFX_MANAGE_STATE(AfxGetStaticModuleState());
   return true;
} // End of Init for CHL2LoaderPlugIn
Esempio n. 25
0
STDAPI DllCanUnloadNow(void)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	return AfxDllCanUnloadNow();
}
void CHL2LoaderPlugIn::Uninitialize()
{
   AFX_MANAGE_STATE(AfxGetStaticModuleState());
} // End of Uninitialize for CHL2LoaderPlugIn
HRESULT CMultimediaExemplarObject::InstallHostExtensions(IModule* pModule)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

	HRESULT hr = S_OK;
	CComPtr<IThing> pHostEx;
	CComBSTR bstrName;
	CComBSTR bstrNameInternal;
	CComPtr<IPropertyList> pMenu;
	CComPtr<IPropertyList> pPeerMenu;
	CComPtr<IMenuItem> pMenuItem;

	hr = m_pWorld->get_Exemplar(CComBSTR("Host"), &pHostEx);

	// Delete the peer menu, the current peer menu, which won't have MM additions (Approach...)
	hr = pHostEx->RemoveProperty(CComBSTR("PeerMenu"));
	if (FAILED(hr))
	{
		VWTRACE(m_pWorld, "VWMM", VWT_ERROR, "CMultimediaExemplarObject::InstallHostExtensions  Unable to remove peer menu, hr = %x\n", hr);
		goto ERROR_ENCOUNTERED;
	}


	// Now re-get the menu (this will get the avatar MM version) and re-add LogOff
	hr = pHostEx->get_ObjectProperty(CComBSTR("PeerMenu"), (IObjectProperty**) &pPeerMenu);
	if (FAILED(hr))
		goto ERROR_ENCOUNTERED;

	// make a copy (since not COPYONGET)
	hr = CreateMenu(m_pWorld, &pMenu);
	if (FAILED(hr))
		goto ERROR_ENCOUNTERED;

	hr = pPeerMenu->CopyTo(pMenu);
	if (FAILED(hr))
		goto ERROR_ENCOUNTERED;

	// Add Log off... to peer menu list
	hr = CreateMenuItemExt(	m_pWorld, CComBSTR("Log off..."), 0, NULL,
									CComBSTR("UpdateIsAvatarAndNotWizard"), CComBSTR("ShowLogOffDialog"), 
									NULL,  &pMenuItem);
	if (FAILED(hr))
		goto ERROR_ENCOUNTERED;

//	pMenuItem->put_SortOrder(MI_SORT_PRIMARY+110);

	hr = pMenuItem->put_AddTargetParameter(VARIANT_TRUE);
	if (FAILED(hr))
		goto ERROR_ENCOUNTERED;

	hr = pMenu->AddObjectProperty(pMenuItem);
	if (FAILED(hr))
		goto ERROR_ENCOUNTERED;

	hr = pHostEx->put_ObjectProperty(CComBSTR("PeerMenu"), pMenu);

ERROR_ENCOUNTERED:
	if (hr != S_OK)
		VWTRACE(m_pWorld, "VWMM", VWT_ERROR, "CMultimediaExemplarObject::Install   Error encountered\n");
	return hr;
}
Esempio n. 28
0
// This is called when the user first loads the add-in, and on start-up
//  of each subsequent Developer Studio session
STDMETHODIMP CDSAddIn::OnConnection(IApplication* pApp, VARIANT_BOOL bFirstTime,
		long dwCookie, VARIANT_BOOL* OnConnection)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	
	// Store info passed to us
	IApplication* pApplication = NULL;
	if (FAILED(pApp->QueryInterface(IID_IApplication, (void**) &pApplication))
		|| pApplication == NULL)
	{
		*OnConnection = VARIANT_FALSE;
		return S_OK;
	}
	g_pApplication = pApplication;

	m_dwCookie = dwCookie;

	// Create command dispatch, send info back to DevStudio
	CCommandsObj::CreateInstance(&m_pCommands);
	m_pCommands->AddRef();

	// The QueryInterface above AddRef'd the Application object.  It will
	//  be Release'd in CCommand's destructor.
	m_pCommands->SetApplicationObject(pApplication);

	// (see stdafx.h for the definition of VERIFY_OK)

	VERIFY_OK(pApplication->SetAddInInfo((long) AfxGetInstanceHandle(),
		(LPDISPATCH) m_pCommands, IDR_TOOLBAR_MEDIUM, IDR_TOOLBAR_LARGE, m_dwCookie));

	// Inform DevStudio of the commands we implement

	// TODO: Replace the AddCommand call below with a series of calls,
	//  one for each command your add-in will add.

	// The command name should not be localized to other languages.  The 
	//  tooltip, command description, and other strings related to this
	//  command are stored in the string table (IDS_CMD_STRING) and should
	//  be localized.
	LPCTSTR szCommand = _T("ShowFunctionsAddinCommand");
	VARIANT_BOOL bRet;
	CString strCmdString;
	strCmdString.LoadString(IDS_CMD_STRING);
	strCmdString = szCommand + strCmdString;
	CComBSTR bszCmdString(strCmdString);
	CComBSTR bszMethod(_T("ShowFunctionsAddinCommandMethod"));
	CComBSTR bszCmdName(szCommand);
	VERIFY_OK(pApplication->AddCommand(bszCmdString, bszMethod, 0, m_dwCookie, &bRet));
	if (bRet == VARIANT_FALSE)
	{
		// AddCommand failed because a command with this name already
		//  exists.  You may try adding your command under a different name.
		//  Or, you can fail to load as we will do here.
		*OnConnection = VARIANT_FALSE;
		return S_OK;
	}

	// Add toolbar buttons only if this is the first time the add-in
	//  is being loaded.  Toolbar buttons are automatically remembered
	//  by Developer Studio from session to session, so we should only
	//  add the toolbar buttons once.
	if (bFirstTime == VARIANT_TRUE)
	{
		VERIFY_OK(pApplication->
			AddCommandBarButton(dsGlyph, bszCmdName, m_dwCookie));
	}

	// Create the WWhizInterface.
	g_wwhizInterface = WWhizInterface2Create(AfxGetInstanceHandle(), pApplication);

	*OnConnection = VARIANT_TRUE;
	return S_OK;
}
Esempio n. 29
0
//
//		Please see MFC Technical Notes 33 and 58 for additional
//		details.
//

// CAppResourcesApp

BEGIN_MESSAGE_MAP(CAppResourcesApp, CWinApp)
END_MESSAGE_MAP()


// CAppResourcesApp construction

CAppResourcesApp::CAppResourcesApp()
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState())
}


// The one and only CAppResourcesApp object

CAppResourcesApp theApp;


// CAppResourcesApp initialization

BOOL CAppResourcesApp::InitInstance()
{
	CWinApp::InitInstance();

	return TRUE;
/**
 * Function name    CDialogGenBase::SetAlias
 * Description      sets the alias for the st object
 * @param           CString Alias
 * @return          -
 * @exception       -
 * @see             -
*/
void CDialogGenBase::SetAlias(CString Alias)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
    m_ObjPropGenBase.m_Alias = Alias;
}