?
Solved

Displaying properties from a COM object at runtime

Posted on 2002-03-06
6
Medium Priority
?
205 Views
Last Modified: 2013-11-23
Hi All,

I have a question I hope you can answer. A company has sent me a COM object to assist me in interfacing with their SMS (text message) API.

I've installed the COM object via the import type library and all this worked fine.

But the runtime properties of the component created are those of a generic COM object e.g. AutoConnect, ConnectKind etc. I know the COM object has public properties and events because I can access them at runtime e.g. smsTo, smsFrom. But some I would like to set at design time because they never change - just me being lazy I guess because I could set them on program initialisation.

Is there anyway I can easily get the public properties/events of the COM object to display at design time instead of the standard ones? Or would I need to write my own 'wrapper' around the COM object? If this is the case, what is the best method for doing that?

Sorry if I have missed something glaring obvious (like it can't be done easily!) but I don't do hardly any programming with my own components or COM objects - I tend to stay with the standard stuff or bought in third party components.

TIA - Trevor.
0
Comment
Question by:trevorb
[X]
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
  • 3
  • 2
6 Comments
 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 600 total points
ID: 6850408
Open the type library and view it as source. There's your COM wrapper... :-)
How to do that? Use the menu: "View/Toggle form/unit" or press key F12.

Okay, look in this source for the COM object you're using. You will find quite a lot of methods with the additional parameters and whatever else Delphi can extract from the COM object. It will probably show you some useful hints too but it does look a bit complex sometimes.
The code insight will also show you this information if the variable you use to contain the object is of the type of the object. If it's an OleVariant then Delphi has no way knowing what methods it supports.
0
 

Author Comment

by:trevorb
ID: 6850485
Thanks for the initial help workshop_alex, but perhaps I wasn't clear in what I was trying to achieve - sorry.

I've already looked at the source generated by the import type library so I know what properties I have available. And my initial software already uses these. I can set and read these at runtime. But they don't appear in the Object Inspector. All I get in there are generic (?) COM object properties like AutoConnect, ConnectKind etc I was hoping the public properties from the actual object would (could?) be displayed there like smsUserName, smsPassword etc stuff that I only need to set once and forget about.

I've imported other stuff before (like the Adobe PDF object and Twain Control) and these normally display the public properties associated with the object.

Again, I apologise if I've completely misunderstood what is achievable here.

Trevor.
0
 

Expert Comment

by:CleanupPing
ID: 9343307
trevorb:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:trevorb
ID: 9343422
Sorry I didn't close the question, I was hoping for further comment because I still have problems with both of these. But I will close this topic off if you feel I must. I will award the points to workshop_alex as at least he went someway to helping me. I was just hoping that some day someone might answer my question.
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 9348341
Oh, I forgot about this question, apparantly. Sorry about that...

Now, to get back at this, the properties of the COM object are public, not published. So you won't see them in the object inspector. Actually, this is not a bad thing because otherwise the COM objects would also be active during design time. That would make development a bit more difficult. Some COM objects will work quite nice from the IDE but others can be too complex for the IDE to handle correctly. Furthermore, if you'd run the application you'd create a second COM object. And this might affect the way your application handles itself.

Developing with COM objects if a lot easier when they're only active at runtime. Personally, I don't even use the Delphi wrappers and create the *_TLB.pas files without the wrapper code. You might not want to activate the COM objects while in design-time because the COM object itself might also initialize a lot of other things. And if you can't activate them, you can't set their properties either.
0
 

Author Comment

by:trevorb
ID: 9405489
Cheers for the extra info Workshop_Alex, appreciated. An extra 12 months experience now means I can see the reasoning behind the points you are making. Thanks!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

770 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