I would like to change these references so that they use an
environment variable. I assumed I could use the syntax of Visual
Studio .net along the following lines:
Reference = ($MyEnvironmentVar)MyDll.dll
where MyEnvironmentVar is a path such as C:\MyDllDir\
But I can not get this reference to work. Is there some other way to
work with enviroment variables in the VB6 project file? Is there any
way to work with environment variables in VB6 projects?
Thanks,
Dan
e.g.
Environ("APPDATA")
--
Jan Hyde
Short version: No.
Long version: Not without writing something to handle the .vbp file as (for
example) a makefile template.
If you have multiple developers working on the project, how about putting the
DLLs (or whatever) on a network share, and have everyone map it to the same
drive letter?
--
I support drug tests. Test the politicians.
Thanks for the responses. I guess it is not possible to use
environment variables in the .vbp and VB6 without some type of macro-
replacement.
The network share approach won't work for us, because most developers
needs a stable set of libraries on which to build. We could run into
issues updating the network share. Also, we have a global development
team with many distributed developers (working from home and other
diverse places) so we need to be able to build off of local hard
drives.
Dan
> On Aug 18, 10:43�am, "Auric__" <not.my.r...@email.address> wrote:
>> On Tue, 18 Aug 2009 13:55:47 GMT, Dan wrote:
>> > Our company usesVisualBasic6 for some legacy applications. For a
>> > long time, we have suffered with several hardcoded paths in the VB6
>> >projectfiles( .VBP) under the Reference Section.
>>
>> > I would like to change these references so that they use an
>> > environment variable. I assumed I could use the syntax ofVisual
>> > Studio .net along the following lines:
>>
>> > Reference = ($MyEnvironmentVar)MyDll.dll
>>
>> > where MyEnvironmentVar is a path such as C:\MyDllDir\
>>
>> > But I can not get this reference to work. Is there some other way to
>> > work with enviroment variables in the VB6projectfile? Is there any
>> > way to work with environment variables in VB6 projects?
>>
>> Short version: No.
>>
>> Long version: Not without writing something to handle the .vbpfile as
>> (for example) a makefile template.
>>
>> If you have multiple developers working on theproject, how about
>> putting the DLLs (or whatever) on a network share, and have everyone
>> map it to the same drive letter?
>
> Thanks for the responses. I guess it is not possible to use
> environment variables in the .vbp and VB6 without some type of macro-
> replacement.
>
> The network share approach won't work for us, because most developers
> needs a stable set of libraries on which to build. We could run into
> issues updating the network share. Also, we have a global development
> team with many distributed developers (working from home and other
> diverse places) so we need to be able to build off of local hard
> drives.
You could have them use LoadLibrary in the actual code. It would work
something like this (untested pseudo-code):
x$ = Environ$("MyEnvironmentVar")
if (Right$(x$, 1) <> "\" then x$ = x$ & "\"
l$ = x$ & "MyDll.dll"
if len(dir(l$)) then
hWnd& = LoadLibrary(l$)
if hWnd& then
p& = GetProcAddress(hWnd&, "FunctionNameGoesHere")
if p& then
CallWindowProc p&, param1, param2, .....
else
error 5 'Invalid procedure call
end if
FreeLibrary hWnd&
else
error 48 'Error in loading code resource or DLL
end if
else
msgbox "can't find MyDll.dll"
end if
Alternately, if you're primarily a .Net group, why not port the app to
VB.Net?
--
You're behind on your scientific literature.