VISA32.dll is a standardized Virtual Instrumentation Software Architecture
function library that is published by several manufacturers. I need the
manufacturer name of the *installed* library.
David
Maybe... http://vbnet.mvps.org/index.html?code/fileapi/filesearchinfo.htm ?
Search the newsgroups for "vb -dotnet VerQueryValue CompanyName".
Start Here: http://msdn.microsoft.com/en-us/library/ms647003(VS.85).aspx
"David Youngblood" <d...@flash.net> wrote in message
news:%23oPqMid...@TK2MSFTNGP06.phx.gbl...
Dave O.
And if it's a standard DLL then one could use SearchPath() API function,
which search for a file in the search path, and returns the full path.
David
"MikeB" wrote:
> .
>
Not an issue with this dll. There can be only one in the system path and it
is the single access point to the VISA library. It is a standard dll, not
AxtiveX. I need the vendor name so that I'll know where to search the
registry for the information that I need.
David
> Not an issue with this dll. There can be only one in the system path
That would be impossible to enforce.
You probably want the first one in the system paths order.
So the easiest method would be to get the system path, break it down into
separate folders then search them in order until you find your file.
Dave O.
It would appear that the only way to duplicate the windows search order is
to let windows conduct the search.
Private Sub Command1_Click()
Print FindDllPath("VISA32.dll")
End Sub
Private Function FindDllPath(ByVal filename As String) As String
Dim sPath As String
Dim hModule As Long
Dim iBytes As Long
hModule = LoadLibrary(filename)
If hModule Then
sPath = Space(MAX_PATH)
iBytes = GetModuleFileName(hModule, sPath, Len(sPath))
FindDllPath = Left$(sPath, iBytes)
End If
FreeLibrary hModule
End Function
David
No, you get the path comspec. If you are not familiar with the environment
variable "Path" open a command window and type: Path
this will return the path list where each folder is separated by a semicolon
and crucially the folders are listed in the order the system searches them
(after first searching the current folder).
So to expand on what I said before, you retrieve the Path environment
variable, split it on ; then search each folder in the order returned by the
Split command.
But if GetModuleFileName works then use that, I'm just pointing out that you
can do it directly.
Regards
Dave O.
http://msdn.microsoft.com/en-us/library/ms682586(VS.85).aspx
This is where I got my information. Are you saying the documentation is
wrong? In each case the PATH Environment variable is number 6 on the list of
where to search. The dll should have been found by the time the search gets
here.
David
No the documentation is correct but also a bit disingenuous because the
System folder and the Windows folder are also in the Path. Also I should
have said current & application instead of just "current", mea culpa,
however unless specifically set in the shortcut or changed in the program
they will more often than not be one and the same. So the only one that I
have not covered is the 16bit system folder which is not used by much except
legacy drivers.
Regards
Dave O.