Re: Loadlibrary returns err.lastdellerror 127

Tech-Archive recommends: Speed Up your PC by fixing your registry




"Prescott" <pchartier@xxxxxxxxx> wrote in message
news:1189445418.566919.217710@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
<snipped>


Forget the "Fortran Version".
Use the "Win32 DLL" Version.
Forget registering the Dll.
Forget using LoadLibrary.
Forget capturing any bloody error messages except for the VB Error - which
is "... Not Found".

Delete all "play/test" code except a Declare Statement and a Call to Foo.


Declare Function foo Lib "MyDll.dll" ( ByRef StringArray() as String,
ByVal NumElements as Long)


Do make sure MyDll.dll is spelled correctly, and the Declare Statement is in
Scope from where you make the call to "foo".
Make sure you don't have any other "foo"s or extra "MyDll"s laying around
somewhere.
(Don't laugh, it has happened.)

If the Lib argument is declared with a full path, eg "C:\Junk\MyDll.dll"
then that path and that path alone is searched. If you don't use a full
path, then the search paths used. They are:

1) The folder the app is started-up in.
2) The current directory of the app (which may or may not be the same)
3) The Windows system directories C:\WINDOWS\SYSTEM and C:\WINDOWS\SYSTEM32
4) The Windows directory, C:\WINDOWS; or C:\WinNt; %SystemRoot%
5) The Folders listed in the PATH environmental variable.

It may not be MyDll that can not be found, it might be some component that
MyDll is dependent on that is missing in that environment. The search path
for dependent Dlls is EXACTLY the same as for the primary Dll.

If your VB App works in the IDE but when compiled it doesn't then it is
because something outlined above is different for the two environments (the
project vs. the wild).

Perhaps the Fortran runtime?

Anyway, don't go off on any other exotic adventures. The solution will be
found in the information above. <g>

-ralpth


.



Relevant Pages

  • Unable to call external program/dll
    ... This lead me to try ShellExecute by using a Declare statement. ... It turns out I cannot call any external Dll. ... Return value is always zero. ... is this a "security" fix in xp or office? ...
    (microsoft.public.excel.programming)
  • DLL and Type Library
    ... I have found that on WINCE there is a very large overhead in calling a DLL ... from VB via a DECLARE statement. ... the object browser in the EVB development environment, and I can call it OK ...
    (microsoft.public.windowsce.embedded.vb)
  • Re: DLL and Type Library
    ... > I have found that on WINCE there is a very large overhead in calling a DLL ... > from VB via a DECLARE statement. ... > the object browser in the EVB development environment, ...
    (microsoft.public.windowsce.embedded.vb)
  • Re: App.Path
    ... The search path for a DLL given in a declare statement without any file ... The path can't be specified at run time but only at design time, ... the declare statement isn't a real code statement which is executed at ...
    (microsoft.public.vb.winapi)
  • Re: How do I use a non-registerable, non-windows dll in VB Code
    ... developing the DLL. ... The declare statement only works with stdcall ... C++ functions use cdecl by default. ... > You will need to write a Declare statement for the exported function. ...
    (microsoft.public.vb.com)