网站首页  词典首页

请输入您要查询的函数:

 

术语 writeconsole
释义 WriteConsole
语法:
C++
BOOL WINAPI WriteConsole(
__in HANDLE hConsoleOutput,
__in const VOID *lpBuffer,
__in DWORD nNumberOfCharsToWrite,
__out LPDWORD lpNumberOfCharsWritten,
__reserved LPVOID lpReserved
);
WriteConsole功能
一个字符串写入到控制台屏幕缓冲区在当前光标位置开始。
参数
hConsoleOutput [in]
句柄到控制台屏幕缓冲区。句柄必须有GENERIC_WRITE访问权限。有关更多信息,参见控制台缓冲区安全和访问权限。
lpBuffer [in]
一个缓冲区,其中包含的字符指针写入到控制台屏幕缓冲区。总大小必须小于64K的。
nNumberOfCharsToWrite [in]
数量的TCHARs写。如果指定数量的字符总大小超过64 KB的,该函数失败,ERROR_NOT_ENOUGH_MEMORY。
lpNumberOfCharsWritten [out]
一个变量,它接收人数的TCHARs实际写入指针。
lpReserved
版权所有;必须为NULL。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
该WriteConsole功能字符写入到控制台,在当前光标位置屏幕缓冲区。作为文字,书写光标位置的进步。该SetConsoleCursorPosition函数设置当前光标位置。
文字,书写使用前景色和背景颜色属性与控制台屏幕缓冲区有关。该SetConsoleTextAttribute功能改变这些颜色。要确定当前的颜色属性和当前光标位置,使用GetConsoleScreenBufferInfo。
在输入模式所有这些影响WriteFile函数的行为已对WriteConsole相同的效果。检索和设置的一个控制台屏幕缓冲区,使用GetConsoleMode和SetConsoleMode职能的输出模式。
此函数使用任何Unicode字符或ANSI字符从控制台的当前代码页。控制台的代码页默认最初系统的OEM代码页。要更改控制台的代码页,使用SetConsoleCP或SetConsoleOutputCP功能,或使用chcp处长或节能模式选择=命令。
双方WriteConsole和WriteFile可用于主机的I / O虽然WriteConsole支持Unicode字符写入到控制台屏幕缓冲区,WriteFile没有。然而,WriteConsole失败如果是一个标准的句柄被重定向到一个文件中使用。如果一个应用程序处理多语言的输出可以被重定向,确定是否输出句柄是一个控制台手柄(一个方法是调用GetConsoleMode功能,检查它是否成功)。如果句柄是一个控制台处理,请WriteConsole,否则,将输出重定向,您应该调用WideCharToMultiByte将文本转换到当前代码页和WriteFile执行的I / O
虽然应用程序可以使用在ANSI模式WriteConsole写ANSI字符,控制台不支持ANSI转义序列。但是,某些功能提供相同的功能。有关更多信息,请参阅SetCursorPos,SetConsoleTextAttribute和GetConsoleCursorInfo。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWincon.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode和ANSI namesWriteConsoleW(Unicode)和WriteConsoleA(ANSI)的
参见
控制台函数
GetConsoleCursorInfo
GetConsoleMode
GetConsoleScreenBufferInfo
输入和输出方法
ReadConsole
SetConsoleCP
SetConsoleCursorPosition
SetConsoleMode
SetConsoleOutputCP
SetConsoleTextAttribute
SetCursorPos
WriteFile
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==WriteConsole Function
Writes a character string to a console screen buffer beginning at the current cursor location.
Syntax
C++
BOOL WINAPI WriteConsole(
__in HANDLE hConsoleOutput,
__in const VOID *lpBuffer,
__in DWORD nNumberOfCharsToWrite,
__out LPDWORD lpNumberOfCharsWritten,
__reserved LPVOID lpReserved
);
Parameters
hConsoleOutput [in]
A handle to the console screen buffer. The handle must have the GENERIC_WRITE access right. For more information, see Console Buffer Security and Access Rights .
lpBuffer [in]
A pointer to a buffer that contains characters to be written to the console screen buffer. The total size must be less than 64K.
nNumberOfCharsToWrite [in]
The number of TCHARs to write. If the total size of the specified number of characters exceeds 64 KB, the function fails with ERROR_NOT_ENOUGH_MEMORY.
lpNumberOfCharsWritten [out]
A pointer to a variable that receives the number of TCHARs actually written.
lpReserved
Reserved; 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
The WriteConsole function writes characters to the console screen buffer at the current cursor position. The cursor position advances as characters are written. The SetConsoleCursorPosition function sets the current cursor position.
Characters are written using the foreground and background color attributes associated with the console screen buffer. The SetConsoleTextAttribute function changes these colors. To determine the current color attributes and the current cursor position, use GetConsoleScreenBufferInfo .
All of the input modes that affect the behavior of the WriteFile function have the same effect on WriteConsole. To retrieve and set the output modes of a console screen buffer, use the GetConsoleMode and SetConsoleMode functions.
This function uses either Unicode characters or ANSI 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.
Both WriteConsole and WriteFile can be used for console I/O. While WriteConsole supports writing Unicode characters to a console screen buffer, WriteFile does not. However, WriteConsole fails if it is used with a standard handle that is redirected to a file. If an application handles multilingual output that can be redirected, determine whether the output handle is a console handle (one method is to call the GetConsoleMode function and check whether it succeeds). If the handle is a console handle, call WriteConsole; otherwise, the output is redirected and you should call WideCharToMultiByte to convert the text to the current code page and WriteFile to perform the I/O.
Although an application can use WriteConsole in ANSI mode to write ANSI characters, consoles do not support ANSI escape sequences. However, some functions provide equivalent functionality. For more information, see SetCursorPos , SetConsoleTextAttribute, and GetConsoleCursorInfo .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWincon.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode and ANSI namesWriteConsoleW (Unicode) and WriteConsoleA (ANSI)
See Also
Console Functions
GetConsoleCursorInfo
GetConsoleMode
GetConsoleScreenBufferInfo
Input and Output Methods
ReadConsole
SetConsoleCP
SetConsoleCursorPosition
SetConsoleMode
SetConsoleOutputCP
SetConsoleTextAttribute
SetCursorPos
WriteFile
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms687401(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:31:43