【发布时间】:2012-05-23 07:42:18
【问题描述】:
#include <stdlib.h>
#include <Windows.h>
#include <Tchar.h>
HANDLE wHnd; // Handle to write to the console.
HANDLE rHnd; // Handle to read from the console.
int _tmain(int argc, _TCHAR* argv[]) {
// Set up the handles for reading/writing:
wHnd = GetStdHandle(STD_OUTPUT_HANDLE);
rHnd = GetStdHandle(STD_INPUT_HANDLE);
// Change the window title:
SetConsoleTitle(TEXT("Win32 Console Control Demo"));
// Set up the required window size:
SMALL_RECT windowSize = {0, 0, 79, 49};
// Change the console window size:
SetConsoleWindowInfo(wHnd, TRUE, &windowSize);
}
报告了一些这样的错误:
'SMALL_RECT' : illegal use of this type as an expression
missing ';' before identifier 'windowSize'
【问题讨论】:
-
您的意思是包括
Windows.h和Tchar.h,而不是windows.h和tchar.h? -
在 CodeBlocks 10.05 上运行良好。
-
@AlexanderBakulin 没关系,因为 Windows 文件系统不区分大小写。
-
@DavidHeffernan:是的,这让我眼前一亮。我仍然看不出这种滥用不区分大小写的原因。