网站首页  词典首页

请输入您要查询的函数:

 

术语 getstdhandle
释义 GetStdHandle
语法:
C++
HANDLE WINAPI GetStdHandle(
__in DWORD nStdHandle
);
GetStdHandle函数
检索的句柄规定的标准设备(标准输入,标准输出或标准错误)。
参数
nStdHandle [in]
标准设备。此参数可以是下列值之一。
ValueMeaning
STD_INPUT_HANDLE
(DWORD值)- 10The标准输入设备。最初,这是控制台CONIN $输入缓冲区。
STD_OUTPUT_HANDLE
(DWORD值),至11标准输出设备。最初,这是积极的控制台CONOUT $屏幕缓冲区。
STD_ERROR_HANDLE
(DWORD值),第十二标准错误设备。最初,这是积极的控制台CONOUT $屏幕缓冲区。
返回值
如果函数成功,返回值是一个句柄指定的设备,或重定向的处理成立以前调用SetStdHandle。该把手GENERIC_READ和GENERIC_WRITE访问权限,除非该应用程序利用SetStdHandle定出标准的处理较少访问。
如果函数失败,返回值是INVALID_HANDLE_VALUE。为了获得更多错误信息,调用GetLastError。
如果应用程序没有相关的标准处理,如服务,运行在一个交互式桌面上,他们并没有重定向,则返回值为NULL。
备注
由GetStdHandle返回的句柄,可以使用应用程序需要读取或写入到控制台。当创建一个控制台,标准输入句柄是一个句柄控制台输入缓冲区,标准输出和标准错误处理是控制台的积极屏幕缓冲区处理。这些句柄可以通过ReadFile和WriteFile函数,或通过控制台函数,访问控制台输入缓冲区或(例如屏幕缓冲区的任何使用,ReadConsoleInput,WriteConsole,或GetConsoleScreenBufferInfo功能)。
标准处理可能是由对SetStdHandle,在这种情况下GetStdHandle返回重定向处理呼叫重定向一个进程。如果标准处理已经被重定向,您可以指定CONIN美元值调用CreateFile函数来获取句柄到控制台的输入缓冲区。同样,您可以指定CONOUT $值获取句柄到控制台的积极屏幕缓冲区。
实例
有关示例,请参见读输入缓冲区事件。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
控制台函数
控制台拉手
CreateFile
GetConsoleScreenBufferInfo
ReadConsoleInput
ReadFile
SetStdHandle
WriteConsole
WriteFile
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==GetStdHandle Function
Retrieves a handle to the specified standard device (standard input, standard output, or standard error).
Syntax
C++
HANDLE WINAPI GetStdHandle(
__in DWORD nStdHandle
);
Parameters
nStdHandle [in]
The standard device. This parameter can be one of the following values.
ValueMeaning
STD_INPUT_HANDLE
(DWORD)-10The standard input device. Initially, this is the console input buffer, CONIN$.
STD_OUTPUT_HANDLE
(DWORD)-11The standard output device. Initially, this is the active console screen buffer, CONOUT$.
STD_ERROR_HANDLE
(DWORD)-12The standard error device. Initially, this is the active console screen buffer, CONOUT$.

Return Value
If the function succeeds, the return value is a handle to the specified device, or a redirected handle set by a previous call to SetStdHandle . The handle has GENERIC_READ and GENERIC_WRITE access rights, unless the application has used SetStdHandle to set a standard handle with lesser access.
If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError .
If an application does not have associated standard handles, such as a service running on an interactive desktop, and has not redirected them, the return value is NULL.
Remarks
Handles returned by GetStdHandle can be used by applications that need to read from or write to the console. When a console is created, the standard input handle is a handle to the console's input buffer, and the standard output and standard error handles are handles of the console's active screen buffer. These handles can be used by the ReadFile and WriteFile functions, or by any of the console functions that access the console input buffer or a screen buffer (for example, the ReadConsoleInput , WriteConsole , or GetConsoleScreenBufferInfo functions).
The standard handles of a process may be redirected by a call to SetStdHandle, in which case GetStdHandle returns the redirected handle. If the standard handles have been redirected, you can specify the CONIN$ value in a call to the CreateFile function to get a handle to a console's input buffer. Similarly, you can specify the CONOUT$ value to get a handle to a console's active screen buffer.
Examples
For an example, see Reading Input Buffer Events .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
Console Functions
Console Handles
CreateFile
GetConsoleScreenBufferInfo
ReadConsoleInput
ReadFile
SetStdHandle
WriteConsole
WriteFile
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms683231(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 13:25:14