[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Displaying properties from a COM object at runtime

Posted on 2002-03-06
6
Medium Priority
?
208 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

649 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