Einzelnen Beitrag anzeigen

matz_abg

Registriert seit: 27. Okt 2003
Ort: Ahrensburg
8 Beiträge
 
Delphi 7 Enterprise
 
#1

COM Collections durchsuchen

  Alt 1. Nov 2003, 16:54
Ich möchte Allfusion - ERwin - Datenmodelle mit Hilfe einer Standard-API von CA (SCAPI.DLL) analysieren und verändern. Ich habe aus der DLL eine Type-Library generiert und auch erste Zugriffe auf die Datenmodelle hinbekommen. Einige Objekte sind aber als Collections definiert, die ich in Delphi analog dem VB-Konstrukt FOR EACH ... IN ... auswerten möchte. Bisher habe ich nur Beispiele gefunden, die die Implementierung des COM-Servers beschreiben. Gibt es auch eine EINFACHE Beschreibung für den Client.

Anbei ein Auszug aus der Type Library der die beiden Interfaces zeigt. Die ISCModelObjectCollection habe ich, jetzt muss ich auf die darin enthaltenen ISCModelObjects zugreifen.

Bin für jede Hilfe dankbar.
Matthias

Delphi-Quellcode:
// *********************************************************************//
// Schnittstelle: ISCModelObjectCollection
// Flags: (4432) Hidden Dual OleAutomation Dispatchable
// GUID: {490B97F5-FCB8-11D2-90A1-0010A4F2AD9E}
// *********************************************************************//
  ISCModelObjectCollection = interface(IDispatch)
    ['{490B97F5-FCB8-11D2-90A1-0010A4F2AD9E}']
    function Get_Item(nIndex: OleVariant; Class_: OleVariant): ISCModelObject; safecall;
    function Get_Count: Integer; safecall;
    function Get__NewEnum: IUnknown; safecall;
    function Get_Root: ISCModelObject; safecall;
    function Get_ClassIds: PSafeArray; safecall;
    function Get_ClassNames: PSafeArray; safecall;
    function Get_Depth: Integer; safecall;
    function Get_MustBeOn: SC_ModelObjectFlags; safecall;
    function Get_MustBeOff: SC_ModelObjectFlags; safecall;
    function Collect(Root: OleVariant; ClassId: OleVariant; Depth: OleVariant;
                     MustBeOn: OleVariant; MustBeOff: OleVariant): ISCModelObjectCollection; safecall;
    function Add(Class_: OleVariant; ObjectId: OleVariant): ISCModelObject; safecall;
    function Remove(Object_: OleVariant): WordBool; safecall;
    property Item[nIndex: OleVariant; Class_: OleVariant]: ISCModelObject read Get_Item;
    property Count: Integer read Get_Count;
    property _NewEnum: IUnknown read Get__NewEnum;
    property Root: ISCModelObject read Get_Root;
    property ClassIds: PSafeArray read Get_ClassIds;
    property ClassNames: PSafeArray read Get_ClassNames;
    property Depth: Integer read Get_Depth;
    property MustBeOn: SC_ModelObjectFlags read Get_MustBeOn;
    property MustBeOff: SC_ModelObjectFlags read Get_MustBeOff;
  end;


// *********************************************************************//
// Schnittstelle: ISCModelObject
// Flags: (4432) Hidden Dual OleAutomation Dispatchable
// GUID: {490B97F7-FCB8-11D2-90A1-0010A4F2AD9E}
// *********************************************************************//
  ISCModelObject = interface(IDispatch)
    ['{490B97F7-FCB8-11D2-90A1-0010A4F2AD9E}']
    function Get__className: WideString; safecall;
    function Get_ObjectId: SC_OBJID; safecall;
    function Get_Name: WideString; safecall;
    function Get_ClassId: SC_CLSID; safecall;
    function Get_Context: ISCModelObject; safecall;
    function Get_Flags: SC_ModelObjectFlags; safecall;
    function Get_Properties: ISCModelPropertyCollection; safecall;
    function CollectProperties(ClassIds: OleVariant; MustBeOn: OleVariant; MustBeOff: OleVariant): ISCModelPropertyCollection; safecall;
    function IsInstanceOf(ClassId: OleVariant): WordBool; safecall;
    function IsValid: WordBool; safecall;
    property _className: WideString read Get__className;
    property ObjectId: SC_OBJID read Get_ObjectId;
    property Name: WideString read Get_Name;
    property ClassId: SC_CLSID read Get_ClassId;
    property Context: ISCModelObject read Get_Context;
    property Flags: SC_ModelObjectFlags read Get_Flags;
    property Properties: ISCModelPropertyCollection read Get_Properties;
  end;
[edit=sakura][delphi]-Tags gesetzt. Mfg, sakura[/edit]
  Mit Zitat antworten Zitat