Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Read File Properties

0 views
Skip to first unread message

David Youngblood

unread,
Nov 20, 2009, 6:56:21 AM11/20/09
to
How would I read the file version properties of a standard DLL? In
particular I need the company name property from VISA32.dll.

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


Jeff Johnson

unread,
Nov 20, 2009, 9:27:34 AM11/20/09
to
"David Youngblood" <d...@flash.net> wrote in message
news:%23oPqMid...@TK2MSFTNGP06.phx.gbl...

Maybe... http://vbnet.mvps.org/index.html?code/fileapi/filesearchinfo.htm ?


Nobody

unread,
Nov 20, 2009, 9:30:53 AM11/20/09
to
"David Youngblood" <d...@flash.net> wrote in message
news:%23oPqMid...@TK2MSFTNGP06.phx.gbl...

Search the newsgroups for "vb -dotnet VerQueryValue CompanyName".


MikeB

unread,
Nov 20, 2009, 11:04:33 AM11/20/09
to
GetFileVersionInfo Function

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.

unread,
Nov 20, 2009, 11:31:52 AM11/20/09
to

"David Youngblood" <d...@flash.net> wrote in message
news:%23oPqMid...@TK2MSFTNGP06.phx.gbl...
In addition to what the others have said there is another issue, there may
be multiple copies of the file from different vendors on the machine but
probably only one is registered and that would be the one you are interested
in. You should consider finding some code to read the registry or to get
associations out of the registry.
I suspect this is going to be a non-trivial task. A interesting start might
be to search your registry for any "VISA32.DLL" entries.

Dave O.


Nobody

unread,
Nov 20, 2009, 11:39:12 AM11/20/09
to
"Dave O." <nob...@nowhere.com> wrote in message
news:%235Gf37f...@TK2MSFTNGP04.phx.gbl...

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.


dwy

unread,
Nov 20, 2009, 12:03:01 PM11/20/09
to
Thanks Jeff, Nobody, MikeB,
Thats exactly what I needed, I just didn't know what to search on.

David


"MikeB" wrote:

> .
>

dwy

unread,
Nov 20, 2009, 12:30:03 PM11/20/09
to
"Dave O." 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

Dave O.

unread,
Nov 23, 2009, 4:47:33 AM11/23/09
to
>> In addition to what the others have said there is another issue, there
>> may
>> be multiple copies of the file from different vendors on the machine but
>> probably only one is registered and that would be the one you are
>> interested
>> in.

> 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.


David Youngblood

unread,
Dec 1, 2009, 7:11:32 AM12/1/09
to
"Dave O." <nob...@nowhere.com> wrote...

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


Dave O.

unread,
Dec 1, 2009, 9:49:44 AM12/1/09
to

"David Youngblood" <d...@flash.net> wrote in message
news:uPvHV%23ncKH...@TK2MSFTNGP06.phx.gbl...

> "Dave O." <nob...@nowhere.com> wrote...
>>>> In addition to what the others have said there is another issue, there
>>>> may
>>>> be multiple copies of the file from different vendors on the machine
>>>> but
>>>> probably only one is registered and that would be the one you are
>>>> interested
>>>> in.
>>
>>> 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.
>
> It would appear that the only way to duplicate the windows search order is
> to let windows conduct the search.

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.


dwy

unread,
Dec 1, 2009, 11:33:01 AM12/1/09
to

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

Dave O.

unread,
Dec 2, 2009, 5:41:05 AM12/2/09
to

"dwy" <d...@discussions.microsoft.com> wrote in message
news:793CB185-EAB3-4267...@microsoft.com...

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.


0 new messages