void MainDialog::OnSelchangeListDevices()
{
    HRESULT hr;    
    IEnumMoniker *pEnumCat = NULL;

    // Get the currently selected category name
    UINT nItem;
    const CLSID *clsid;
    
	m_DeviceList.GetCurrentSelection(&nItem);

    if (m_bShowAllCategories)
    {
        // Read the CLSID pointer from the list box's item data
        clsid = (CLSID *) m_DeviceList.GetItem(nItem);
    }
    else
    {
        // Read the CLSID pointer from our hard-coded array of
        // documented filter categories
        clsid = categories[nItem].pclsid;
    }

    // If the CLSID wasn't allocated earlier, then fail
    if (clsid != NULL)
    {
		//
		// WARNING!
		//
		// Some third-party filters throw an exception (int 3) during enumeration
		// on Debug builds, often due to heap corruption in RtlFreeHeap().
		// Sometimes it is done intentionally to prevent reverse engineering.
		// 
		// This is not an issue on Release builds.
		//

		// Enumerate all filters of the selected category  
		hr = m_pSysDevEnum->CreateClassEnumerator(*clsid, &pEnumCat, 0);

		// Enumerate all filters using the category enumerator
		if (SUCCEEDED(hr))
		{
			hr = EnumFilters(pEnumCat);
		}

		// Go ahead and select the first filter in the list, if it exists
		if (SUCCEEDED(hr) && m_FilterList.Count() > 0)
		{
			m_FilterList.Select(0);
			OnSelchangeListFilters();
		}
	}
    SAFE_RELEASE(pEnumCat);
}
Beispiel #2
0
BOOL CFilterProp::OnInitDialog() 
{
	CDialog::OnInitDialog();

	InitLanguage(); 

	m_ListFilters.ResetContent();

	// Enumarate filters with property page.
	EnumFilters();

	if ( m_ListFilters.GetCurSel()==LB_ERR )
		m_ButtonProp.EnableWindow(FALSE);
	else 
		m_ButtonProp.EnableWindow(TRUE);
	
	m_Brightness.SetTicFreq(10); 
	m_Brightness.SetPageSize(10);
	m_Brightness.SetPos(pOptions->valBrightness);

	m_Contrast.SetTicFreq(10); 
	m_Contrast.SetPageSize(10);
	m_Contrast.SetPos(pOptions->valContrast);

	m_Saturation.SetTicFreq(10); 
	m_Saturation.SetPageSize(10);
	m_Saturation.SetPos(pOptions->valSaturation);


	char sz[32];

	sprintf(sz," %i\n[IRE]", m_Brightness.GetPos() );
	m_stcBrightness.SetWindowText(sz);

	sprintf(sz," %i\n[IRE]", m_Contrast.GetPos() );
	m_stcContrast.SetWindowText(sz);

	sprintf(sz," %i\n[IRE]", m_Saturation.GetPos() );
	m_stcSaturation.SetWindowText(sz);

	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}