Limiting the Property Sheet Display

The property sheet should display only on the relevant application filter.

To limit the property sheet display

  1. Select a unique name for the application filter; for example, its GUID.
  2. Add the folder containing the file Msfpccom.dll (<SDK installation root>\bin) to the include path.
  3. In Stdafx.h add the following #import statement:
    #import "msfpccom.dll" named_guids
    

    The #import directive is used to incorporate information from a type library. The content of the type library is converted into C++ classes, mostly describing the COM interfaces.

  4. In the .cpp file where your snap-in is defined, add the if statement in the following example code to the method that creates property pages and change the GUID to the GUID of your application filter:
    HRESULT CFilterSnapInExtData::CreatePropertyPages(LPPROPERTYSHEETCALLBACK lpProvider,
    	long handle, 
    	IUnknown* pUnk,
    	DATA_OBJECT_TYPES type)
    {
    	FPCLib::IFPCSnapinNodePtr spiSnapinNode(m_pDataObject);
     
    	FPCLib::IFPCApplicationFilterPtr spiApplicationFilter(spiSnapinNode->CurrentObject);
    
    	_bstr_t bstrGUID(spiApplicationFilter->get_Guid());
     
    	// if (type == CCT_SCOPE || type == CCT_RESULT) 
    	if (bstrGUID == _bstr_t("{7CCF6FF0-D995-4da1-B452-4228047B2D1D}"))  // Filter GUID
    	{
    		CFilterSnapInPage* pPage = new CFilterSnapInPage(handle, true, _T("FilterSnapIn"));
    		lpProvider->AddPage(pPage->Create());
    		// The second parameter to the property page class constructor
    		// should be true for only one page.
     
    		// TODO : Add code here to add additional pages
    		return S_OK;
    }
    	return E_UNEXPECTED;
    }
    
  5. Build.
  6. Test. Run Forefront TMG Management. Notice that the property sheet appears only on the appropriate filter.

Send comments about this topic to Microsoft

Build date: 11/30/2009

© 2008 Microsoft Corporation. All rights reserved.