bhavana75
asked on
How to get the defined value for user environment variables?
Hi All,
I would be facing the value in getting the defined value for user environment variables..
I used ExpandEnvironmentStringsFo rUser(),wh ich is a shell API...
Platform is .NET 2003(VC++.NET),Windows Xp...
getting error like " error C2039: 'ExpandEnvironmentStringsF orUser' : is not a member of 'operator``global namespace'''
I have included UserEnv.h file and also added UserEnv.lib file...
Need suggestion very badly
Thanks in Advance,Deepa.
I would be facing the value in getting the defined value for user environment variables..
I used ExpandEnvironmentStringsFo
Platform is .NET 2003(VC++.NET),Windows Xp...
getting error like " error C2039: 'ExpandEnvironmentStringsF
I have included UserEnv.h file and also added UserEnv.lib file...
Need suggestion very badly
Thanks in Advance,Deepa.
ASKER
Thanks for your response....I would need the win32 APIs only...Eventhough my platform is VC++.NET..Just explain me how to use ExpandEnvironmentStringsFo rUser() function...
Thanks,Deepa.
Thanks,Deepa.
Since ExpandEnvironmentStringsFo rUser is included in Windows XP and Windows 2000 Professional, you need to add precompiler constants before including of Userenv.h, as described here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/using_the_windows_headers.asp
Try this:
#define _WIN32_WINNT 0x0500
#include <Userenv.h>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/using_the_windows_headers.asp
Try this:
#define _WIN32_WINNT 0x0500
#include <Userenv.h>
ASKER
tried with what you said ...But there is no luck Alex.....
still getting the error as
error C3861: 'ExpandEnvironmentStringsF orUser': identifier not found, even with argument-dependent lookup...
Thanks in Advance,deepa.
still getting the error as
error C3861: 'ExpandEnvironmentStringsF
Thanks in Advance,deepa.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
WINVER problem is usually result of working without SDK.
ASKER
Hi Jkr,
I have implemented the way u suggested..It started working...
Thanks ...
Does this function works only for windows versions which are higher than NT & later or for other windows versions also like win98,me,etc..
Thanks,Deepa.
I have implemented the way u suggested..It started working...
Thanks ...
Does this function works only for windows versions which are higher than NT & later or for other windows versions also like win98,me,etc..
Thanks,Deepa.
ASKER
Hi Alex,
>>WINVER problem is usually result of working without SDK...
I didnt understand exactly what working without SDK...
Thanks,Deepa.
>>WINVER problem is usually result of working without SDK...
I didnt understand exactly what working without SDK...
Thanks,Deepa.
WINVER is defined in SDK headers to the latest Windows version. If there are some problems with WINVER, this usually means that SDK is not installed or it's headers are not used by VC++ compiler.
SDK can be downloaded from Microsoft WEB site:
http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en
In the list of VC++ include directories (Tools - Options - Directories - Include files) SDK include directory should be listed on the first place, before VC++ include directories. The same for library directories.
SDK can be downloaded from Microsoft WEB site:
http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en
In the list of VC++ include directories (Tools - Options - Directories - Include files) SDK include directory should be listed on the first place, before VC++ include directories. The same for library directories.
'ExpandEnvironmentStringsF
Microsoft.Win32.Registry class
Microsoft.Win32.RegistryKe