> Can someone point me to an explanation and examples on how
> Delphi 4/5 can
> call a VB6 DLL?
>
I'm going on the assumption you mean "a VB6 ActiveX dll". If you mean
otherwise, feel free to ignore this message and I apologize for
misunderstanding.
Anyway, the first thing you need to do is to register the target dll.
(Regsvr32.exe will do the trick) Once you've done that, open up
Delphi and start your project you want to use it from. Then, go
Project|Import Type Library and scroll until you find the dll you want to
use. (It may not have the same name as the dll, so you'll probably need to
know the classname or the company that made it, etc.)
Highlight it, then go down to the lower left corner and uncheck the
"Generate Component Wrapper" option. I have found that trying to use these
"wrappers" is an exercise in futility. It does a great job on simple
modules, but more complex ones (especially if they have more than one class)
are next to useless through the wrapper. Anyway, then click the "Create
Unit" button. This will create a file called _TLB.pas for use in
your program. This will contain all of the information that could be
extracted from the interface and is what you need to start programming with.
All of the classes in the file should be of the format _. VB
prefixes all classes with an underscore...I could bore you with the details
of why, but that's not for here. *8)
Anyway, to use a class, say _MyClass, it's pretty straightforward.
PROCEDURE TMyForm.CreateVBDLLObject;
VAR
objMyClass : _MyClass;
BEGIN
objMyClass := coMyClass.Create;
objMyClass.MyRoutine;
objMyClass := NIL;
END;
There will always be an associated co-class, so in this instance, it's
coMyClass. Use that to create the object, and use the _MyClass object type
reference to hold what it returns.
Anyway, I hope this is what you were asking...if not ... well, maybe someone
else lurking on the list could use the information.
Todd Lang