Com+ Create compile error


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.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Have you tried without a owner?

oMailer := TMail.Create(nil);

Regards, Geo

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gary4Author Commented:
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.
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?
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Wim ten BrinkSelf-employed developerCommented:
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...
Gary4Author Commented:

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?

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.