I've put that DLL in the app's folder (where the source code, the exe,
and all the rest of the project files are), in the \Windows\system32
folder, in the \Windows\system folder, and in the \Windows folder. It
didn't matter where I put it, it wasn't found in any of those places.
Here's how it's declared in the vb bas module:
Declare Function pgovlCreateOverlayFile Lib "pgOverlay.dll" (ByVal
sFilename As String) As Long
Also, just to make sure that the function is in the DLL with the right
name and arguments, I checked it with Dependency Walker and the
function is in the DLL and I'm calling it correctly. (Besides the
error was about the DLL file not being found, not about some kind of
calling/argument error.)
Note there's no path hard coded into the declaration. I'm using
Windows Xp.
Any idea why it's not finding it in the folders that it's supposed to
be looking in?
Where the heck is it searching for it?
In the case where you have checked the obvious, then it is likely it is not
"pgOverlay.dll" that the Windows Loader can't find, but rather some
component pgOverlay is dependent on that can't be found.
-ralph
Yes, usually.
Occasionally, runtimes don't show up in Dependancy Walker. What language /
development tool was the Dll written in?
We are talking about a 'standard' DLL here, correct?
If it is an ActiveX Dll then it has to be registered, and accessed by early
binding or automation, ie, you don't use the Declare functions.
-ralph
I'm going to try to hard code the path to this DLL in the ...\Release
folder and see if that works, just as a test to see if it runs - I
don't want to leave the path hard coded in there permanently. I'll
post back....
What I have so far:
'--------------------------------------------------------------------------------------------------------------
' Declare the pgOverlay functions that are contained in the
pgOverlay.DLL file.
' It seems that if the pgOverlay file does not reside in the same
folder as the
' Aphelion ActiveX DLL's, then it can't find pgOverlay.DLL,
' even if pgOverlay.DLL is in one of the folders on the normal search
order (folders that Windows looks in to find it).
' If pgOverlay is not in the Aphelion/Program folder, then even hard
coding the full path to pgOverlay.DLL won't help it work
' Note: "C:\PROGRA~1\Aphelion\Program" is in the PATH Environment
variable.
' This DOES NOT work, even if pgOverlay.dll is in the Aphelion\Program
folder which is in the PATH Environment Variable
' and where the Aphelion ActiveX DLLs are.
Declare Function pgovlCloseOverlayFile Lib "pgOverlay.dll" (ByVal
lngFilePointer As Long) As Long
Declare Function pgovlCreateOverlayFile Lib "pgOverlay.dll" (ByVal
sFilename As String) As Long
' This DOES work, as long as pgOverlay resides in the folder "c:
\program files\Aphelion\Program"
' which is where the Aphelion ActiveX DLL's live.
'Declare Function pgovlCloseOverlayFile Lib "c:\program files\Aphelion
\Program\pgOverlay.dll" (ByVal lngFilePointer As Long) As Long
'Declare Function pgovlCreateOverlayFile Lib "c:\program files\Aphelion
\Program\pgOverlay.dll" (ByVal sFilename As String) As Long
Which I'm glad to see. Just wrote a wordy reply that contained mostly items
which we can now eliminate. <g>
Found a reference to this being a problem if the system %PATH% variable is
too long, however, it appears to be O/S specfic and repaired. For grins why
not move the Aphelian folder up close to the front of the PATH EnvVar
string.
Make sure you have only one copy of "pgOverlay.dll" on the box. Temporarily
rename the others, as the search routine will bail on the first one if
finds. It appears that it is not actually "pgOverlay.dll" that is the
problem, but finding the components it depends on after you find it.
Warning Exotic Possiblity and Air Code follow... <g>
Since Vista, various security changes in the O/S, (and new C++ compiler
options are availble) to prevent a DLL being called outside of certain
contexts.
What other environments or applications is this DLL used for?
For grins create a simple VB Exe and use the WinAPI to test.
Private Declare Function GetModuleHandle Lib "kernel32" Alias
"GetModuleHandleA" _
(ByVal lpModuleName As String) As Long
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" _
(ByVal lpLibFileName As String) As Long
Private Declare Function GetProcAddress Lib "kernel32" _
(ByValhModule As Long, ByVal lpProcName As String) As Long
Private Declare Function FreeLibrary Lib "kernel32" _
(ByVal hLibModule As Long) As Long
Public Function IsExported(ByVal ModuleName As _String, _
ByVal ProcName As String) As Boolean
Dim hModule As Long
Dim lpProc As Long
Dim FreeLib As Boolean
' check to see if module is already loaded
hModule = GetModuleHandle(ModuleName)
If hModule = 0 Then
hModule = LoadLibrary(ModuleName)
FreeLib = True
End If
' check to verify it's exported.
If hModule Then
lpProc = GetProcAddress(hModule, ProcName)
Exported = (lpProc <> 0)
End If
' unload library if we loaded it here.
If FreeLib Then Call FreeLibrary(hModule)
End Function
This will use the LoadLibrary process directly thus generally removing any
subtle nuances the VB Declare Function statement might have on a new O/S.
Plus if you cannot get around using a fullpath with the VB statement, this
process will allow you to access the library/functions building a dynamic
path at runtime. It will be easier if you also create a typelib for the Dll.
-ralph
I'm still not exactly sure why my DLL had to live where the dependent
ActiveX DLL's live (because those DLLs' folder was on the path), but
hey, as long as it's working...
Thanks again for taking the time to help me with this!
P.S. The path was very lengthy - maybe around 400 characters or more:
C:\Program Files\Notes5;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%
\System32\Wbem;%SystemRoot%\system32\nls;%SystemRoot%\system32\nls
\ENGLISH;c:\program files\ixos\ixos ecd viewer\bin;C:\Program Files
\Hewlett-Packard\OpenView\service desk 4.5\client\bin;C:\Program Files
\MATLAB\R2009b\runtime\win32;C:\Program Files\MATLAB\R2010a\runtime
\win32;C:\Program Files\MATLAB\R2010a\bin;C:\Program Files\MATLAB
\R2009b\bin;C:\Program Files\Common Files\Adobe\AGL;C:\Program Files
\TortoiseSVN\bin;C:\Program Files\Microsoft SQL Server\90\Tools\binn
\;C:\Program Files\QuickTime\QTSystem\;C:\PROGRA~1\Aphelion\Program
I guess it needs cleaning - I don't even use Notes anymore for email -
it's been uninstalled! I'm using Windows XP. Is there are limit to
the length of the PATH environment variable in WinXP?