vb.NET constructor call from Delphi using COM

Posted on 2006-05-16
Last Modified: 2013-11-25
I have received a dll-file. I have registered the file using the following exe-files from the command-line:
regasm.exe /tlb (makes type library)

Afterwards I have opened a new project in Delphi - imported the type library and are referring to the new pas-file under uses. So far so good.

My problem arises when I try to make an instance (an object) of a class from the dll-file. I don't ever get to call the constructor because there is no method on the class that I can call (I was looking for a create-method). Is there any way to call the constructor?

I can add that in VBA I would write the following line and the constructor would automatically be called:

Dim MyObject as New TestClass

But how do I call the constructor from Delphi?

Best regards

Question by:flycht
    LVL 3

    Expert Comment

    Have you tried using CreateOleObject?

    Author Comment

    Hi trainsdse

    Actually I found out that there was a coClass with a create-constructor. It seems to work.

    Best regards


    Accepted Solution

    PAQed with points refunded (250)

    Community Support Moderator

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    c# combobox autocomplete behavior 6 62
    sumHeights2  challenge 7 51
    SQL400 max size 5 34
    delphi parse string to params 3 49
    A short article about a problem I had getting the GPS LocationListener working.
    Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
    This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
    The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now