Board index » delphi » Calling Delphi DLL from VB 5

Calling Delphi DLL from VB 5

Hi
    I am trying to write a VB 5 interface for my Delphi dll. I can call the
Delphi dll fine from Delphi, but VB 5 complains at run time when I call the
dll. It reports 'File not found - Error 53' saying it could not find the dll
file. The file is in fact in the project directory and is spelt correctly. I
am calling a dummy procedure, so it is not the procedure code itself that is
the problem.

I have created a dummy dll which does nothing, and I can call that ok.

Has anybody got any ideas?

Paul Harrington

 

Re:Calling Delphi DLL from VB 5


Is it possible that when running VB in the IDE, that the current working
directory is not the project directory, but actually the directory where the
VB IDE executable is located?   If so, it wouldn't find your DLL if it's in
the project directory.

You might try copying your DLL to the Windows and/or Windows/System
directories since Windows will usually search either one or both of them
when looking for a DLL.

--
Vinnie Murdico
Software with Brains, Inc.
SWBTracker - Value-Priced Bug Tracking Software
http://www.softwarewithbrains.com

Re:Calling Delphi DLL from VB 5


Im Artikel <7v_R3.730$L%4.118...@server2.news.adelphia.net>, "Vinnie M."
<vin...@softwarewithbrains.com> schreibt:

Quote
>Is it possible that when running VB in the IDE, that the current working
>directory is not the project directory, but actually the directory where the
>VB IDE executable is located?   If so, it wouldn't find your DLL if it's in
>the project directory.

A good idea! A ChDir and ChDrive to the current project directory (ExePath?)
also eliminates such problems.

DoDi

Re:Calling Delphi DLL from VB 5


Thanks for the ideas - I had tried moving the dll to various places +
checking proj dir already though.

I have found the answer to the problem - it was caused by my program using a
Delphi VCL unit (used to allow Delphi strings to be passed to dlls) which
required another dll not normally present in the windows system dir. I found
it by trial and error, as VB does not report that my dll failed to find
another dll. It just said that my dll file could not be found - a bit
confusing really.

Thanks for helping anyway

Paul

Quote
Paul Harrington <Paul.Harring...@net.ntl.com> wrote in message

news:7v9loc$oce$1@nclient7-gui.server.ntli.net...
Quote
> Hi
>     I am trying to write a VB 5 interface for my Delphi dll. I can call
the
> Delphi dll fine from Delphi, but VB 5 complains at run time when I call
the
> dll. It reports 'File not found - Error 53' saying it could not find the
dll
> file. The file is in fact in the project directory and is spelt correctly.
I
> am calling a dummy procedure, so it is not the procedure code itself that
is
> the problem.

> I have created a dummy dll which does nothing, and I can call that ok.

> Has anybody got any ideas?

> Paul Harrington

Other Threads