网站首页  词典首页

请输入您要查询的函数:

 

术语 getenvironmentvariable
释义 GetEnvironmentVariable
语法:
C++
DWORD WINAPI GetEnvironmentVariable(
__in_opt LPCTSTR lpName,
__out_opt LPTSTR lpBuffer,
__in DWORD nSize
);
GetEnvironmentVariable函数
检索的内容,从调用进程环境块指定的变量。
参数
lpName [中,可选]
环境变量的名称。
lpBuffer [指出,可选]
一个缓冲区,接收指定的环境变量的内容为空指针结尾的字符串。一个环境变量有32,767个字符,包括空终止字符的最大大小限制。
nSize [in]
缓冲区的大小指向的lpBuffer参数,以字符。
返回值
如果函数成功,返回值是存储在缓冲区中的字符数指向lpBuffer,不包括终止空字符。
如果lpBuffer是不够大,无法保存数据,返回值是缓冲区的大小,以字符,须持有该字符串和终止空字符。
如果函数失败,返回值是零。如果指定的环境变量不是在环境块发现,GetLastError返回ERROR_ENVVAR_NOT_FOUND。
备注
此功能也可以检索系统环境变量或用户环境变量。
实例
有关示例,请参阅更改环境变量。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode和ANSI namesGetEnvironmentVariableW(Unicode)和GetEnvironmentVariableA(ANSI)的
参见
环境变量
GetEnvironmentStrings
SetEnvironmentVariable
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==GetEnvironmentVariable Function
Retrieves the contents of the specified variable from the environment block of the calling process.
Syntax
C++
DWORD WINAPI GetEnvironmentVariable(
__in_opt LPCTSTR lpName,
__out_opt LPTSTR lpBuffer,
__in DWORD nSize
);
Parameters
lpName [in, optional]
The name of the environment variable.
lpBuffer [out, optional]
A pointer to a buffer that receives the contents of the specified environment variable as a null-terminated string. An environment variable has a maximum size limit of 32,767 characters, including the null-terminating character.
nSize [in]
The size of the buffer pointed to by the lpBuffer parameter, in characters.
Return Value
If the function succeeds, the return value is the number of characters stored in the buffer pointed to by lpBuffer, not including the terminating null character.
If lpBuffer is not large enough to hold the data, the return value is the buffer size, in characters, required to hold the string and its terminating null character.
If the function fails, the return value is zero. If the specified environment variable was not found in the environment block, GetLastError returns ERROR_ENVVAR_NOT_FOUND.
Remarks
This function can retrieve either a system environment variable or a user environment variable.
Examples
For an example, see Changing Environment Variables .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode and ANSI namesGetEnvironmentVariableW (Unicode) and GetEnvironmentVariableA (ANSI)
See Also
Environment Variables
GetEnvironmentStrings
SetEnvironmentVariable
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms683188(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:28:17