A short example would be nice, a tutorial would be nicer.

How do I set up custom system environments from within HLA code (is it even possible)?

The only other way I can think of is to set up a program-local environment and search for files in each location manually until found.
Posted on 2003-11-21 20:48:58 by Kain

A short example would be nice, a tutorial would be nicer.

How do I set up custom system environments from within HLA code (is it even possible)?

The only other way I can think of is to set up a program-local environment and search for files in each location manually until found.


You can set up an environment variable for the current process, but the changes are lost when the process quits. The only way to set global environment variables is through the registry. The initHLA.HLA application provides an example of this.

I assume this is what you're asking about.

There is a Win32 API function call for manipulating environment variables. I don't have the reference handy right now. But adding environment variable support to the ARGs module wouldn't be a bad idea at all. Having a module to read and modify INI files would be nice, too.
Cheers,
Randy Hyde
Posted on 2003-11-22 01:37:42 by rhyde
I'm more interested in the temporary process environment saved into (and loaded from) an ini file rather than modifying the registery.

I don't want anybody messing around with my registry (they have a tendency to pollute). on the same note, I don't like to mess around with somebody else's registry.
Posted on 2003-11-22 13:22:08 by Kain

I'm more interested in the temporary process environment saved into (and loaded from) an ini file rather than modifying the registery.

I don't want anybody messing around with my registry (they have a tendency to pollute). on the same note, I don't like to mess around with somebody else's registry.


Here are some Win32 API functions you should look at:

ExpandEnvironmentStrings
FreeEnvironmentStrings
GetEnvironmentStrings
GetEnvironmentVariable
SetEnvironmentVariable

These functions are part of the kernel32.lib module. You can find documentation for kernel32 here:
http://webster.cs.ucr.edu/Page_win32/0_win32asm.html

Keep in mind that whenever Windows returns a string to an application, it is a zero terminated string, not an HLA string. Therefore, you might want to run the return strings through a function like conv.cStrToStr or something similar if you want to process these strings using HLA string functions.

Note, btw, that you'll get the prototypes for the above by including the "w.hhf" header file.
Cheers,
Randy Hyde
Posted on 2003-11-23 00:16:13 by rhyde
Thanks. I didn't know where to start, this has been much help
Posted on 2003-11-23 02:49:01 by Kain