Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

[COM+] ICatalogObject, enumerating VALUES

Posted on 2003-10-22
2
771 Views
Last Modified: 2012-06-27
W2K, COM+ 1.0, Delphi 7...

Okay, I want to have a list of all values of a single ICatalogObject object. Looking at the interface I see NO function to do this. Do you see one in this interface:

  ICatalogObject = interface(IDispatch)
    ['{6EB22871-8A19-11D0-81B6-00A0C9231C29}']
    function Get_Value(const bstrPropName: WideString): OleVariant; safecall;
    procedure Set_Value(const bstrPropName: WideString; retval: OleVariant); safecall;
    function Get_Key: OleVariant; safecall;
    function Get_Name: OleVariant; safecall;
    function IsPropertyReadOnly(const bstrPropName: WideString): WordBool; safecall;
    function Get_Valid: WordBool; safecall;
    function IsPropertyWriteOnly(const bstrPropName: WideString): WordBool; safecall;
    property Value[const bstrPropName: WideString]: OleVariant read Get_Value write Set_Value;
    property Key: OleVariant read Get_Key;
    property Name: OleVariant read Get_Name;
    property Valid: WordBool read Get_Valid;
  end;

So I have to access the Value[] property with a known property name. And yes, I know these property names already and I even have a special stringlist which contains these property names for every possible implementation of this interface.

However, what I want is to enumerate all components, interfaces and methods of my COM+ application including ALL value properties. And my code looks less efficient if I cannot enumerate these value property names because it means maintaining lists of value property names myself...

Is there a way to enumerate them? If so, tell me and the points are yours. If not, sorry but I have a working solution already. Just not a very efficient one... I don't need another work-around solution...
0
Comment
Question by:Wim ten Brink
2 Comments
 
LVL 26

Accepted Solution

by:
Russell Libby earned 500 total points
ID: 9600165

There is no way once you have hit the ICatalogObject level... But, there is a way if you got the catalog object from a catalog collection, and still have access to the collection.

If this is not the case, then I can't help.
If this is the case, then query the collection as follows:

var
     ccComps:    ICatalogCollection;  // Your collection
     ccProps:      ICatalogCollection;
     coComp:      ICatalogObject;     // Your catalog object
     ovProp:        OleVariant;
     i:                 Integer;

  ccProps:=ccComps.GetCollection('PropertyInfo', '') as ICatalogCollection;
  ccProps.Populate;

  // Get the catalog object
  coComp:=ccComps.Item[0] as ICatalogObject;
 
  // Example of listing the properties for the catalog object
  for i:=0 to Pred(ccProps.Count) do
  begin
    ovProp:=ccProps.Item[i];
    ShowMessage(ovProp.Name);
    ShowMessage(coComp.Value[ovProp.Name]);
  end;

----

Hope this helps,
Russell
0
 
LVL 17

Author Comment

by:Wim ten Brink
ID: 9605311
Since all I have to do is walk through the COM+ application and enumerate as much information as possible, I still have access to the catalog and the object. Basically, I just walk through everything and write the information to a simple text file. This is used to validate if the installation is installed correctly and it will be used to be compared with future snapshots just to check if no one tampered with it.

I tested your code and it worked! Wonderful! Now my application isn't just a bit easier, it is also better compatible with newer Windows versions. Especially the differences between W2K and W2K+3 were a bit difficult to overcome if I had to maintain a list of constants. :-)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi : could not find program, '...exe' 2 191
Comparing dates in Delphi. Greater than/ Less than 3 214
find a node in VST 2 70
Delphi Seattle StructureView color 1 14
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question