ho utilizzato questo codice:
codice:
CString CpApp::query(IUnknown* pUnk )
{
    //if ( pUnk != NULL && ( ERROR_SUCCESS == key.Open( HKEY_CLASSES_ROOT, _T("Interface") ) ) )
        {
			HRESULT hr;
			CLSID clsid; 
			IID id;
			IUnknown *punk;
			hr = CLSIDFromProgID(L"Sap2000.SapObject", &clsid); 
			hr =CoCreateInstance(clsid,NULL,CLSCTX_SERVER,IID_IUnknown, (void **)&punk) ;
			
			CRegKey* key = new CRegKey();
			key->Open( HKEY_CLASSES_ROOT, _T("Interface"));
            TCHAR szKeyName[1024] = _T("");
			for ( int i = 0; ERROR_SUCCESS == RegEnumKey( key->m_hKey, i, szKeyName, 1024 ); i++ )
            {
                USES_CONVERSION;
                
                if ( SUCCEEDED( CLSIDFromProgID(L"Sap2000.SapObject",&clsid ) ) )
                {
					Sap2000::_SapObjectPtr spObject;
                    CString str=CString(szKeyName);
					BSTR bstr = str.AllocSysString(); 
					hr =IIDFromString(bstr,&id);
                    
					hr=punk->QueryInterface(id, (void**)&spObject);
					if ( SUCCEEDED(hr))
					{
						//entra per varie interfacce tra cui ad  es IID_IMarshal
						if(id != IID_IUnknown && id != IID_IMarshal)
						{	
							AfxMessageBox("find!!!!");
						}
						TCHAR szValue[1024] = _T(""); 
						LONG ncbValue = 1024;
						ERROR_SUCCESS == RegQueryValue( key->m_hKey,szKeyName, szValue, &ncbValue );
						
					}
				}
			
            }
           key->Close();
		}
		
	return "";
}
per trovare runtime se esiste l'interfaccia sul registro, e esiste propro un interfaccia IID_Sap2000,solo che non so come utilizzarla una volta saputo il nome !
grazie.