На главную

On-line справка по Win32 API

Написать письмо
БЕСПЛАТНАЯ ежедневная online лотерея! Выигрывай каждый день БЕСПЛАТНО!
Список всех статей A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z | Скачать Вниз

WriteConsoleOutput



The WriteConsoleOutput function writes character and color attribute data to a specified rectangular block of character cells in a console screen buffer. The data to be written is taken from a correspondingly sized rectangular block at a specified location in the source buffer.

BOOL WriteConsoleOutput(

HANDLE hConsoleOutput, // handle to a console screen buffer
CONST CHAR_INFO *lpBuffer, // pointer to buffer with data to write
COORD dwBufferSize, // column-row size of source buffer
COORD dwBufferCoord, // upper-left cell to write from
PSMALL_RECT lpWriteRegion // pointer to rectangle to write to
);


Parameters

hConsoleOutput

Identifies the screen buffer. The handle must have GENERIC_WRITE access.

lpBuffer

Points to a source buffer that contains the data to be written to the 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.

dwBufferSize

Specifies the size, in character cells, of the buffer pointed to by the lpBuffer parameter. The X member of the COORD structure is the number of columns; the Y member is the number of rows.

dwBufferCoord

Specifies the coordinates of the upper-left cell in the buffer pointed to by the lpBuffer parameter to write data from. The X member of the COORD structure is the column, and the Y member is the row.

lpWriteRegion

Points to a SMALL_RECT structure. On input, the structure members specify the upper-left and lower-right coordinates of the screen buffer rectangle to write to. On output, the structure members specify the actual rectangle that was written to.



Return Values

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

WriteConsoleOutput treats the source buffer and the destination screen buffer as two-dimensional arrays (columns and rows of character cells). The rectangle pointed to by the lpWriteRegion parameter specifies the size and location of the block to be written to in the screen buffer. A rectangle of the same size is located with its upper-left cell at the coordinates of the dwBufferCoord parameter in the lpBuffer array. Data from the cells that are in the intersection of this rectangle and the source buffer rectangle (whose dimensions are specified by the dwBufferSize parameter) is written to the destination rectangle.

Cells in the destination rectangle whose corresponding source location are outside the boundaries of the source buffer rectangle are left unaffected by the write operation. In other words, these are the cells for which no data is available to be written.
Before WriteConsoleOutput returns, it sets the members of lpWriteRegion to the actual screen buffer rectangle affected by the write operation. This rectangle reflects the cells in the destination rectangle for which there existed a corresponding cell in the source buffer, because WriteConsoleOutput clips the dimensions of the destination rectangle to the boundaries of the screen buffer.

If the rectangle specified by lpWriteRegion lies completely outside the boundaries of the screen buffer, or if the corresponding rectangle is positioned completely outside the boundaries of the source buffer, no data is written. In this case, the function returns with the members of the structure pointed to by the lpWriteRegion
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 screen buffer, use the GetConsoleScreenBufferInfo function.

WriteConsoleOutput has no effect on the cursor position.
Windows NT: This function uses either Unicode characters or 8-bit characters from the console's current codepage. The console's codepage defaults initially to the system's OEM codepage. To change the console's codepage, use the SetConsoleCP or SetConsoleOutputCP functions, or use the chcp or mode con cp select= commands.

See Also

CHAR_INFO, COORD, GetConsoleScreenBufferInfo, ReadConsoleOutput, ReadConsoleOutputAttribute, ReadConsoleOutputCharacter, SetConsoleCP, SetConsoleOutputCP, SMALL_RECT, WriteConsoleOutputAttribute, WriteConsoleOutputCharacter


Пригласи друзей и счет твоего мобильника всегда будет положительным!
Предыдущая статья
 
Сайт Народ.Ру Интернет
Следующая статья
Пригласи друзей и счет твоего мобильника всегда будет положительным!

WriteConsoleOutput



Функция WriteConsoleOutput записывает символ и окрашивает вспомогательные данные определенному прямоугольному блоку символьных ячеек в консольном экранном буфере. Данные, которые нужно записывать, взят из correspondingly измеренного прямоугольного блока в определенной позиции в исходном буфере.

BOOL WriteConsoleOutput(

РУЧКА hConsoleOutput, // оперируется в консольный экранный буфер CONST CHAR_INFO *lpBuffer, // указатель, чтобы буферизоваться с данными, чтобы записывать COORD dwBufferSize, // размер столбца-колонка исходного буфера COORD dwBufferCoord, // верхней левой ячейки, чтобы записываться от указателя PSMALL_RECT lpWriteRegion // до прямоугольника, чтобы записывать, чтобы
);


Параметры

hConsoleOutput

Идентифицирует экранный буфер. Ручка должна иметь доступ GENERIC_WRITE.

lpBuffer

Точки на исходный буфер, что содержит данные, которые нужно записывать в экранный буфер. Этот указатель рассмотрен как начало двумерного массива структур CHAR_INFO, чей размер определен параметром dwBufferSize.

dwBufferSize

Определяет размер, в символьных ячейках, буфера указанного, чтобы параметром lpBuffer. Элемент X структуры COORD является количеством столбцов; элемент Y является количеством колонок.

dwBufferCoord

Определяет координаты верхней левой ячейки в буфере указанном, чтобы параметром lpBuffer, чтобы записывать данные из. Элемент X структуры COORD является столбцом, и элемент Y является колонкой.

lpWriteRegion

Точки на структуру SMALL_RECT. На вводе, структурные участники определяют верхнее левое и более низкое право координат экранного буферного прямоугольника, чтобы записывать, чтобы. На выходе, структурные участники определяют фактический прямоугольник, который был записан, чтобы.



Обратные Величины

Если функция добивается успеха, обратная величина ненулевая.
Если функция терпит неудачу, обратная величина нулевая. Для того, чтобы расширять информацию ошибки, назовите GetLastError.

Замечания

WriteConsoleOutput РАССМАТРИВАЕТ исходный буфер и экранный буфер расположения как двумерный подготавливает (столбцы и колонки символьных ячеек). Прямоугольник указанный, чтобы параметром lpWriteRegion определяет размер и позицию блока, которые нужно записывать, чтобы в экранном буфере. Прямоугольник того же самого размера расположен своей верхней левой ячейкой в координатах параметра dwBufferCoord в массиве lpBuffer. Данные из ячеек, которые - на пересечении этого прямоугольника и исходный буферный прямоугольник (чьи измерения определены параметром dwBufferSize), записаны в прямоугольник расположения.

Ячейки в прямоугольнике расположения чья соответствующая исходная позиция - за пределами границ исходного буферного прямоугольника оставлены незатронутым записывать операцией. Другими словами, эти - ячейки для которых никакие данные не доступно быть записанн.
Перед возврат WriteConsoleOutput, это устанавливает участников lpWriteRegion в фактический экранный буферный прямоугольник пораженный записывать операцией. Этот прямоугольник отражает ячейки в прямоугольнике расположения для которых там существовали соответствующую ячейку в исходном буфере, поскольку WriteConsoleOutput прикрепляет измерения прямоугольника расположения к границам экранного буфера.

Если прямоугольник определялся бы ложью lpWriteRegion полностью за пределами границ экранного буфера, или если соответствующий прямоугольник не позиционируется полностью за пределами границ исходного буфера, никакие данные не записаны. В этом случае, функция возвращается с участниками структуры указанной, чтобы параметром lpWriteRegion установленным так что элемент Права - менее чем Левый, или элемент Низа - менее чем Верх. Для того, чтобы определять размер экранного буфера, используйте функцию GetConsoleScreenBufferInfo.

WriteConsoleOutput НЕ имеет эффект в позиции курсора.
Windows NT: Эта функция использует или символы Уникода или 8- битовых символов из консольного текущего codepage. Консольный codepage устанавливается по умолчанию первоначально в системный codepage OEM. Для того, чтобы изменять консольный codepage, используйте SetConsoleCP или функции SetConsoleOutputCP, или используйте chcp или жулика режима cp выбирать= команды.

Смотри Также

CHAR_INFO, COORD, GetConsoleScreenBufferInfo, ReadConsoleOutput, ReadConsoleOutputAttribute, ReadConsoleOutputCharacter, SetConsoleCP, SetConsoleOutputCP, SMALL_RECT, WriteConsoleOutputAttribute, WriteConsoleOutputCharacter


Вверх Version 1.3, Oct 26 2010 © 2007, 2010, mrhx Вверх
 mrhx software  Русский перевод OpenGL  Русский перевод Win32 API
 
Используются технологии uCoz