简体   繁体   English

C语言中的Win32 API控制台编程

[英]Win32 API Console Programming in C

I am stuck with the problems like, reading text from a specific location (x=10, y=5) on the console window. 我遇到了诸如从控制台窗口上的特定位置(x = 10,y = 5)读取文本之类的问题。

Where can I find a detail tutorial on Win32 API Console mode programming in C? 在哪里可以找到有关使用C语言进行Win32 API控制台模式编程的详细教程?

On MSDN, see the section on Character Mode Applications . 在MSDN上,请参阅“ 字符模式应用程序 ”部分。

You can read text from the screen using the ReadConsoleOutputCharacter function. 您可以使用ReadConsoleOutputCharacter函数从屏幕上读取文本。

You'd need to use ReadConsoleOutput(). 您需要使用ReadConsoleOutput()。 Beware of the ambiguity in a coordinate like (10, 5). 当心像(10,5)这样的坐标中的歧义。 It could be relative from the console window upper-left corner. 从控制台窗口的左上角可以是相对的。 Or from the screen buffer. 或从屏幕缓冲区。 You'd probably need to make the buffer size the same as the window size to avoid this. 为了避免这种情况,您可能需要使缓冲区大小与窗口大小相同。 SetConsoleScreenBufferSize(). SetConsoleScreenBufferSize()。

These console functions are not wrapped by the C-runtime. 这些控制台功能不由C运行时包装。 The SDK documentation is quite decent, start here . SDK文档相当不错, 从此处开始

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM