Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using VB Dll in Delphi

Status
Not open for further replies.

JohnAtFp

Programmer
Jun 9, 2003
6
0
0
AU
Hello

Can anyone show me how to access a Dll written in VB from Delphi? I have tried the normal ways of accessing the Dll but it comes up with errors like "The procedure entry point OpenConn could not be located in the dynamic link library Sample.dll"

Is this because the VB Dll does not have something saying which function to 'export' like in Delphi?
Thanks for any help.

John
 
I taught that VB dll were written C?

Steven van Els
SAvanEls@cq-link.sr
 
I think that VB's dlls are written in C, but you can make ActiveX dlls in VB which I'm pretty sure won't work with another language due to the way they are compiled.


Andy
"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
"Why does my program keep showing error messages every time something goes wrong?"
 
Does that mean that there is 'no way' for say delphi to access a VB dll?
If not, how would one go about access it?

John
 
I think that it is possible, lately there has been a lot of discussions on dll's in this forum. Just do a search with the keyword dll.

Regards

Steven van Els
SAvanEls@cq-link.sr
 
I remembered last night that I learnt this from "Hardcore Visual Basic" which referred to VB5. The way dlls are compiled has changed so they should work...

Sorry to introduce confusion.


Andy
"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
"Why does my program keep showing error messages every time something goes wrong?"
 
Its a long time since I have trifled with calling DLL's from Delphi but...

The Error "The procedure entry point OpenConn could not be located in the dynamic link library Sample.dll" would translate as the program can not find the function/Procedure called "OpenConn" in the "Sample.dll".

I think..

Either that or there may be an error in the "sample.dll".

Opp.
 
The sample.dll is working fine with VB projects. But not with delphi. So how should I get access to that? I have tried conventions methods in delphi but it does not seems to work with the VB dll in particular.

John
 
It's true. Visual Basic only makes Active-X DLLs. These do not work in the same way as ordinary DLLs.

When I discovered this I came across some software you can buy (never found a freeware version) that is an add-on to Visual Basic and allows you to create regular DLLs.

Try a search in google for "Visual DLL". I haven't tried it coz it's expensive, this is purely for information.

See also thread102-216424
 
Ahh.. that would explain it then. How about cuting VB out of the equation altogether and writting DLL in Delphi John ?

Opp.
 
Firstly, to create ordinary Dlls with VB, you would need the source code and the VB software (and the additional add-ons) to create the Dlls right? I do have the source code but not the VB software. Thus I could not recompile and create the Dlls that I need.

Secondly, the reason why I want to use the VB dll is to save time from me having to rewrite the whole thing in Delphi. It would take me (estimate) 2-3 weeks of work just to rewrite the Dlls. Thus I am looking for a way to use VB dlls in Delphi (sad to say I have found none as yet) :(

John
 
Hi

I have not tried to create vb dll(s) and use it in Delphi applications, but I think it should work. It also depends how the dll is build. If you could give me a simple code in VB or wait a couple of days I will try to find something about this topic.

But I have litle time... will try my best. My program will soon be ship out to our customers soon... thats why I have not so much time.

cheers,
mha
 
hi again.

VB:
I startet with new ActiveX Doc dll project.
I created a testFunc that should returns and integer 4
I then made VB.dll

Then some code in Delphi:
function testFunc: Integer;
stdcall; external 'VB.dll';

but I got this message error:
The procedure entry point testFunc could not be located in the dynamic link library VB.dll

Any clue? I have to somehow to export the function in vb?
VB is not my strongest side..

well I tried.. maybe I find it out later..

cheers,
mha
 
Just a thought.. but have you registered the ActiveX Dll with the system? Not sure, but I think you may need to do this first.

I think you can either do it via the commandline (with regsvr32) or from the Delphi IDE.

Opp.
 
Yes... the dll has been registered....can VB create a Dll with an OCX extension? If so, delphi can 'import' OCX files......

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top