网站首页  词典首页

请输入您要查询的函数:

 

术语 readconsole
释义 ReadConsole
语法:
C++
BOOL WINAPI ReadConsole(
__in HANDLE hConsoleInput,
__out LPVOID lpBuffer,
__in DWORD nNumberOfCharsToRead,
__out LPDWORD lpNumberOfCharsRead,
__in_opt LPVOID pInputControl
);
ReadConsole功能
读取从控制台输入缓冲区中的字符输入和从缓冲区中删除它。
参数
hConsoleInput [in]
句柄到控制台输入缓冲区。句柄必须有GENERIC_READ访问的权利。有关更多信息,参见控制台缓冲区安全和访问权限。
lpBuffer [out]
阿一个缓冲区,它接收数据指针读取控制台输入缓冲区。在将小于64K的所需的缓冲区的总大小。
nNumberOfCharsToRead [in]
在TCHARs人数看一看。缓冲区的大小指出的lpBuffer参数,以应至少nNumberOfCharsToRead * sizeof(TCHAR)字节。
lpNumberOfCharsRead [out]
一个变量,它接收人数的TCHARs实际读取的指针。
pInputControl [中,可选]
一个 CONSOLE_READCONSOLE_CONTROL结构,指定控制字符,以表示读操作结束时的指针。此参数可以为NULL。
这个参数需要的Unicode。为ANSI模式,pInputControl参数必须是NULL。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
ReadConsole读取控制台的输入缓冲区键盘输入。它的行为,如ReadFile函数,除了它可以读取任何Unicode(宽字符)或ANSI模式。若要保持应用程序的来源与兼容两种模式单一的一套,使用ReadConsole而不是ReadFile。虽然ReadConsole只能用一个控制台输入缓冲区处理使用ReadFile可与其他处理(如文件或管道)。 ReadConsole失败如果使用标准的句柄已被重定向到,才不是一个控制台处理其他。
在输入模式所有这些影响ReadFile行为对ReadConsole有相同的效果。检索和设置的一个控制台输入缓冲区,使用GetConsoleMode和SetConsoleMode职能的输入模式。
如果输入缓冲区包含比键盘输入事件事件(如鼠标事件或窗口大小事件)等,它们将被放弃。这些事件只能读通过ReadConsoleInput功能。
此函数使用任何Unicode字符或8位字符从控制台的当前代码页。控制台的代码页默认最初系统的OEM代码页。要更改控制台的代码页,使用SetConsoleCP或SetConsoleOutputCP功能,或使用chcp处长或节能模式选择=命令。
该pInputControl参数可以用来使来自读中间唤醒响应文件,完成控制字符,在CONSOLE_READCONSOLE_CONTROL结构中指定。此功能需要扩展命令启用,标准输出句柄是一个控制台输出处理,和投入是Unicode。
Windows Server 2003和Windows XP/2000操作系统:中间读不支持此功能。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWincon.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode和ANSI namesReadConsoleW(Unicode)和ReadConsoleA(ANSI)的
参见
控制台函数
CONSOLE_READCONSOLE_CONTROL
GetConsoleMode
输入和输出方法
ReadConsoleInput
ReadFile
SetConsoleCP
SetConsoleMode
SetConsoleOutputCP
WriteConsole
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==ReadConsole Function
Reads character input from the console input buffer and removes it from the buffer.
Syntax
C++
BOOL WINAPI ReadConsole(
__in HANDLE hConsoleInput,
__out LPVOID lpBuffer,
__in DWORD nNumberOfCharsToRead,
__out LPDWORD lpNumberOfCharsRead,
__in_opt LPVOID pInputControl
);
Parameters
hConsoleInput [in]
A handle to the console input buffer. The handle must have the GENERIC_READ access right. For more information, see Console Buffer Security and Access Rights .
lpBuffer [out]
A pointer to a buffer that receives the data read from the console input buffer. The total size of the buffer required will be less than 64K.
nNumberOfCharsToRead [in]
The number of TCHARs to read. The size of the buffer pointed to by the lpBuffer parameter should be at least nNumberOfCharsToRead * sizeof(TCHAR) bytes.
lpNumberOfCharsRead [out]
A pointer to a variable that receives the number of TCHARs actually read.
pInputControl [in, optional]
A pointer to a CONSOLE_READCONSOLE_CONTROL structure that specifies a control character to signal the end of the read operation. This parameter can be NULL.
This parameter requires Unicode. For ANSI mode, the pInputControl parameter must be NULL.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
Remarks
ReadConsole reads keyboard input from a console's input buffer. It behaves like the ReadFile function, except that it can read in either Unicode (wide-character) or ANSI mode. To have applications that maintain a single set of sources compatible with both modes, use ReadConsole rather than ReadFile. Although ReadConsole can only be used with a console input buffer handle, ReadFile can be used with other handles (such as files or pipes). ReadConsole fails if used with a standard handle that has been redirected to be something other than a console handle.
All of the input modes that affect the behavior of ReadFile have the same effect on ReadConsole. To retrieve and set the input modes of a console input buffer, use the GetConsoleMode and SetConsoleMode functions.
If the input buffer contains input events other than keyboard events (such as mouse events or window-resizing events), they are discarded. Those events can only be read by using the ReadConsoleInput function.
This function uses either Unicode characters or 8-bit characters from the console's current code page. The console's code page defaults initially to the system's OEM code page. To change the console's code page, use the SetConsoleCP or SetConsoleOutputCP functions, or use the chcp or mode con cp select= commands.
The pInputControl parameter can be used to enable intermediate wakeups from the read in response to a file-completion control character specified in a CONSOLE_READCONSOLE_CONTROL structure. This feature requires command extensions to be enabled, the standard output handle to be a console output handle, and input to be Unicode.
Windows Server 2003 and Windows XP/2000: The intermediate read feature is not supported.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWincon.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode and ANSI namesReadConsoleW (Unicode) and ReadConsoleA (ANSI)
See Also
Console Functions
CONSOLE_READCONSOLE_CONTROL
GetConsoleMode
Input and Output Methods
ReadConsoleInput
ReadFile
SetConsoleCP
SetConsoleMode
SetConsoleOutputCP
WriteConsole
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms684958(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:22:31