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

VCL Wrapper for Comobject

Posted on 2000-05-16
8
395 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
  • 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

790 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