Com+ Create compile error

Posted on 2003-10-31
Last Modified: 2010-04-05

I have a COM+ component that was written in VB6.

I am trying to use it in Delphi 6, however when I compile I get the error "Not enough actual parameters" on this line:

      oMailer := TMail.Create;

The constructor that was imputed from the object's type library looks like this:

constructor TMail.Create(AOwner: Component);
  inherited Create(AOwner);
  FProps := TMailProperties.Create(Self);

Now I know that the constructor needs a parameter and I haven't provided one but I have know2 idea what to pass as a parameter.  I have tried a couple of things and each gives some sort of error in the compile.

Any suggestions?

Do you need more information?

I know this is probably an easy question but I need help ASAP.

Question by:Gary4
  • 3
  • 2
LVL 17

Accepted Solution

geobul earned 500 total points
ID: 9657991

Have you tried without a owner?

oMailer := TMail.Create(nil);

Regards, Geo

Author Comment

ID: 9658959
Didn't remember so I tried it again.

Now it gives the error message "Incompatible types: '_mail' and 'TMail'"

Now what?

Maybe I should mention that I'm quite new to Delphi.  Been a long time VB programmer and have done Pascal prior to Object Pascal.  Never done C++ so low-level COM things are new to me also.
LVL 17

Expert Comment

ID: 9661231
It's difficult to say something without the actual code and definitions. What is '_mail'? What is the 'oMailer' type? Where does that error appear - at the same line? And when - compiling or executing?
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

LVL 17

Expert Comment

by:Wim ten Brink
ID: 9667182
Ehm, could this be a class name conflict? I've had similar issues once where I had two units that both declared a class with the same name. And while I expected that I used the correct class, I actually got the wrong one every time. Took me two days to solve the problem!
And the solution is simple. If you have two units with the same class names, use the unit as prefix for the class name. Thus:

oMailer := MailUnit.TMail.Create;

Assuming your class is defined in unit MailUnit...

Author Comment

ID: 9672515

Sorry for taking so long to get back.  Putting nil in my test case worked.

However, now I'm getting other errors when setting properties and I'm noticing some warnings in the type library that Delphi created when it imported the VB Dll.

Should I open another thread to resolve these issues?

LVL 17

Expert Comment

ID: 9672806
I think so. One question per thread is a rule here. When you give your next question a proper title other experts will join also. And I'm afraid I wont be of much help going deeper in COM. On the other hand Workshop_Alex might help you here. Wait one more day at least before closing this thread.

Regards, Geo

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Send message from delphi to whatsapp, is it possible? 3 1,705
Dynamically Created Query 3 62
RESTRequest Parameter 4 43
Installshield for Embarcadero EX 10.1 Berlin 4 60
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…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below.…

821 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