Solved

VCL Wrapper for Comobject

Posted on 2000-05-16
8
399 Views
Last Modified: 2008-02-26
Need short demo showing the right way to wrap a comobject in VCL component.
0
Comment
Question by:lindsoe
[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
  • 2
  • 2
  • 2
  • +2
8 Comments
 

Expert Comment

by:MacNapple
ID: 2814650
When talking about a component, I assume you mean an ActiveX control? Those can be imported automatically into Delphi using Components/Import ActiveX.

If I'm wrong and you mean some other kind of com object, sorry. That would depend much more on the com object itself.
0
 
LVL 4

Expert Comment

by:mhervais
ID: 2815028
listening
0
 
LVL 2

Expert Comment

by:mullet_attack
ID: 2815297
if you're using D5 ...

Click on Project->Import type library
Find your type library...
Make sure "generate component wrapper" is checked, and click 'install'
That's it. Too easy.

I don't know if D4 does this, I never did any COM work with it...
0
Technology Partners: 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!

 

Expert Comment

by:MacNapple
ID: 2816192
I seem to remember it does.
0
 
LVL 10

Expert Comment

by:Lischke
ID: 2816571
Actually, all COM usage is finally a wrapper around an interface using some kind of Delphi class (often TInterfacedObject). Also importing an ActiveX (or IDLs for that matter) is nothing else than creating the correct VCL wrapper (perhaps with extra steps like constant and enumrants declarations etc.).

The general case of creating the VCL wrapper is:

1) create your interface you want to wrap:

  IVTEditLink = interface
    procedure BeginEdit;
    procedure CancelEdit;
    procedure EndEdit;
    :
    etc.
  end;

2) write the actual implementation for this (this is the actual wrapping):

  TStringEditLink = class(TInterfacedObject, IVTEditLink)
  private
    FEdit: TVTEdit; // a normal custom edit control
    :
  public
    constructor Create;
    destructor Destroy; override;

    procedure BeginEdit;
    procedure CancelEdit;
    procedure EndEdit;
    :
  end;

Here appear the declared methods (see IVTEditLink) again, but this time they get an actual implementation.

If you need to know more then just ask... :-)

Ciao, Mike
0
 

Author Comment

by:lindsoe
ID: 2816817
Thanks Mike, this is close to what I need. Could you give a few guidelines for when it is needed to create a CreateVCLComObjectProc as in vclcom.pas and when to implemet IVclComobject?
0
 
LVL 10

Accepted Solution

by:
Lischke earned 400 total points
ID: 2817621
Oh, I have done quite a lot with COM but I never saw this function until you mentioned it here. I doubt you will ever need this in normal projects. Judging from the fact that the only code which sets CreateVCLComObjectProc is in VCLCom.pas which is not included into Classes.pas (there's the variable which holds the procedure), I'd say there's some compiler magic involved here. I don't think you need CreateVCLComObjectProc anyway.

Ciao, Mike
0
 

Author Comment

by:lindsoe
ID: 2817808
Thanks
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

710 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