Link to home
Start Free TrialLog in
Avatar of Madhura122398
Madhura122398

asked on

How to get the System environment variables using MFC API?

Hi,
    We need to get the system CLASSPATH in our Application. Is there any API to get it?
    The GetEnvironmentVariable() method is giving only user variables, but not the system enironment variables.
    One more question: We have used the RegEnumValue to get the registry values from HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\SessionManager\EnvironmentClassapth. But it is returning only some values, but not all the values. What could be the reason?

Please reply as soon as possible as it is very urgent for us.
Thanks in advance
Madhura
Avatar of Gus012498
Gus012498

You could use the
char *getenv( const char *varname );

function.

Regards, Gus
Avatar of Zoppo
Hi Madhura,

Could you post the code where you read the registry using RegEnumValues?

ZOPPO
ASKER CERTIFIED SOLUTION
Avatar of sumant032199
sumant032199
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Its a good idea to suggest my comment as an answer.
Avatar of Madhura122398

ASKER

Thank you very much. It worked perfectly.
For Gus,
Sorry yaar, My idea was not to copy your answer, but what can I do if we know the same thing. As there is no other answer I was compelled to give it.
And one more thing I have added one more point not only yours.

For Madhura.
Thanks for your assessment.
If you do not mind may I know something about you. I guess you are Indian and also Maharashtrian. Will you please add something in your profile?
I stay at Bombay. (Dombivli)