ngpk
asked on
How can I get the value of specific environment variable?
Hello,
I am new to Delphi. I have a question about the environment variable manipulation. I want to know how to define a global environment variable through the program, and how to retrieve the value from existing environment variable?
Many thanks,
ngpk
I am new to Delphi. I have a question about the environment variable manipulation. I want to know how to define a global environment variable through the program, and how to retrieve the value from existing environment variable?
Many thanks,
ngpk
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Are those the variables such as ShortDateFormat?
Don
Don
var Reg: TRegistry; Str: String;
Reg := TRegistry.Create;
// set the Registry directory, I forget how
// Reg.Open('/Variable Path/');
// Note: HKEY CURRENTUSER is default
if Reg.ValueExists('GlobalVar
Str := Reg.ReadString('GlobalVar'
Str := '';
....
Reg.WriteString('GlobalVar
Reg.Free;
Hope this gets you in the right direction, you didn't say which var you are looking for.
Don