网站首页  词典首页

请输入您要查询的函数:

 

术语 readconsoleoutput
释义 ReadConsoleOutput
语法:
C++
BOOL WINAPI ReadConsoleOutput(
__in HANDLE hConsoleOutput,
__out PCHAR_INFO lpBuffer,
__in COORD dwBufferSize,
__in COORD dwBufferCoord,
__inout PSMALL_RECT lpReadRegion
);
ReadConsoleOutput功能
读取的字符单元矩形块的性质和属性数据的颜色在控制台屏幕缓冲区,并在该函数写在目标缓冲区指定位置的数据,一个长方形块。
参数
hConsoleOutput [in]
句柄到控制台屏幕缓冲区。句柄必须有GENERIC_READ访问的权利。有关更多信息,参见控制台缓冲区安全和访问权限。
lpBuffer [out]
一个目的地缓冲区,接收数据的指针读出控制台屏幕缓冲区。该指针将被视为对一两个来源的CHAR_INFO的大小是由dwBufferSize参数指定的结构维数组。数组的总大小必须小于64K的。
dwBufferSize [in]
该lpBuffer参数的大小,以字符单元。该坐标结构X成员的列数;的Y成员的行数。
dwBufferCoord [in]
对在lpBuffer参数,它接收数据的左上角单元格坐标读出控制台屏幕缓冲区。该坐标结构X成员是列,和Y成员行。
lpReadRegion [ in , out ]
一个 SMALL_RECT结构的指针。在输入,结构成员指定的左上角和右下角的控制台屏幕缓冲区的矩形其功能是阅读的坐标。在输出的结构成员指定实际采用矩形。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
ReadConsoleOutput对待控制台屏幕缓冲区,并为二维数组(列和行的字符单元目标缓冲区)。该矩形指向的lpReadRegion参数指定的大小和位置块从控制台屏幕缓冲区读取。一个同样大小的目标矩形位于其上,离开了在lpBuffer阵列dwBufferCoord参数坐标细胞。数据读取在控制台屏幕缓冲区源矩形的细胞被复制到目标缓冲区中相应的单元格。如果相应的细胞外的目标缓冲区的边界是矩形(其尺寸指定的dwBufferSize参数),数据不会被复制。
在目标缓冲区相应的单元格坐标是不属于控制台屏幕缓冲区的边界保持不变。换句话说,这些细胞是没有屏幕的缓冲区中的数据可以被读取。
前ReadConsoleOutput回报,套结构的成员指出的lpReadRegion参数的实际屏幕缓冲区的矩形,其细胞到目标复制到缓冲区。这反映了矩形源矩形的细胞是存在的,在目标缓冲区相应的单元格,因为ReadConsoleOutput剪辑源矩形的尺寸,以适应控制台屏幕缓冲区的边界。
如果lpReadRegion指定的矩形是完全超出了控制台屏幕缓冲区,或者相应的矩形以外的定位目标缓冲区的边界完全没有数据复制的界限。在这种情况下,同结构的成员函数返回指出的lpReadRegion参数来设置,例如,正确的成员比左,或底部的成员少比前少。要确定控制台屏幕缓冲区,使用GetConsoleScreenBufferInfo功能的大小。
该ReadConsoleOutput函数没有控制台上的缓冲区的光标位置的影响。在控制台的屏幕缓冲区的内容没有改变的功能。
此函数使用任何Unicode字符或8位字符从控制台的当前代码页。控制台的代码页默认最初系统的OEM代码页。要更改控制台的代码页,使用SetConsoleCP或SetConsoleOutputCP功能,或使用chcp处长或节能模式选择=命令。
实例
有关示例,请参见读,写汉字和属性块。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWincon.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode和ANSI namesReadConsoleOutputW(Unicode)和ReadConsoleOutputA(ANSI)的
参见
控制台函数
低级别控制台输出函数
ReadConsoleOutputAttribute
ReadConsoleOutputCharacter
SetConsoleCP
SetConsoleOutputCP
SMALL_RECT
WriteConsoleOutput
CHAR_INFO
COORD
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==ReadConsoleOutput Function
Reads character and color attribute data from a rectangular block of character cells in a console screen buffer, and the function writes the data to a rectangular block at a specified location in the destination buffer.
Syntax
C++
BOOL WINAPI ReadConsoleOutput(
__in HANDLE hConsoleOutput,
__out PCHAR_INFO lpBuffer,
__in COORD dwBufferSize,
__in COORD dwBufferCoord,
__inout PSMALL_RECT lpReadRegion
);
Parameters
hConsoleOutput [in]
A handle to the console screen 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 destination buffer that receives the data read from the console screen buffer. This pointer is treated as the origin of a two-dimensional array of CHAR_INFO structures whose size is specified by the dwBufferSize parameter. The total size of the array must be less than 64K.
dwBufferSize [in]
The size of the lpBuffer parameter, in character cells. The X member of the COORD structure is the number of columns; the Y member is the number of rows.
dwBufferCoord [in]
The coordinates of the upper-left cell in the lpBuffer parameter that receives the data read from the console screen buffer. The X member of the COORD structure is the column, and the Y member is the row.
lpReadRegion [in, out]
A pointer to a SMALL_RECT structure. On input, the structure members specify the upper-left and lower-right coordinates of the console screen buffer rectangle from which the function is to read. On output, the structure members specify the actual rectangle that was used.
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
ReadConsoleOutput treats the console screen buffer and the destination buffer as two-dimensional arrays (columns and rows of character cells). The rectangle pointed to by the lpReadRegion parameter specifies the size and location of the block to be read from the console screen buffer. A destination rectangle of the same size is located with its upper-left cell at the coordinates of the dwBufferCoord parameter in the lpBuffer array. Data read from the cells in the console screen buffer source rectangle is copied to the corresponding cells in the destination buffer. If the corresponding cell is outside the boundaries of the destination buffer rectangle (whose dimensions are specified by the dwBufferSize parameter), the data is not copied.
Cells in the destination buffer corresponding to coordinates that are not within the boundaries of the console screen buffer are left unchanged. In other words, these are the cells for which no screen buffer data is available to be read.
Before ReadConsoleOutput returns, it sets the members of the structure pointed to by the lpReadRegion parameter to the actual screen buffer rectangle whose cells were copied into the destination buffer. This rectangle reflects the cells in the source rectangle for which there existed a corresponding cell in the destination buffer, because ReadConsoleOutput clips the dimensions of the source rectangle to fit the boundaries of the console screen buffer.
If the rectangle specified by lpReadRegion lies completely outside the boundaries of the console screen buffer, or if the corresponding rectangle is positioned completely outside the boundaries of the destination buffer, no data is copied. In this case, the function returns with the members of the structure pointed to by the lpReadRegion parameter set such that the Right member is less than the Left, or the Bottom member is less than the Top. To determine the size of the console screen buffer, use the GetConsoleScreenBufferInfo function.
The ReadConsoleOutput function has no effect on the console screen buffer's cursor position. The contents of the console screen buffer are not changed by the 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.
Examples
For an example, see Reading and Writing Blocks of Characters and Attributes .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWincon.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode and ANSI namesReadConsoleOutputW (Unicode) and ReadConsoleOutputA (ANSI)
See Also
Console Functions
Low-Level Console Output Functions
ReadConsoleOutputAttribute
ReadConsoleOutputCharacter
SetConsoleCP
SetConsoleOutputCP
SMALL_RECT
WriteConsoleOutput
CHAR_INFO
COORD
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms684965(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:47