hOutput = GetStdHandle (STD_OUTPUT_HANDLE); buf [0] = 0; while (wcscmp (buf, L"quit") != 0) { DWORD read, written; printf ("\n$"); param.dwInitLen = 0; param.dwUnknown = 0; // 我们使用^F和^D来进行自动补齐 param.dwWakeMask = (1 << Ctrl ('F')) | (1 << Ctrl ('D')); again: if (ReadConsoleW (hInput, buf, 0x100, &read, ¶m)) { if (buf [read-1] == Ctrl ('F')) { // 用户按下了^F键, 自动补齐字符串"fff", // 然后继续等待输入 wcscpy (buf+read-1, L"fff"); WriteConsoleW (hOutput, L"fff", 3, &written, NULL); param.dwInitLen = read - 1 + 3; goto again; } else if (buf [read-1] == Ctrl ('D')) { // 用户按下了^D键, 自动补齐字符串"ddd", // 然后继续等待输入 wcscpy (buf+read-1, L"ddd"); WriteConsoleW (hOutput, L"ddd", 3, |
正在阅读:让你的控制台程序也支持自动补齐让你的控制台程序也支持自动补齐
2004-03-29 10:06
出处:CSDN
责任编辑:linjixiong
键盘也能翻页,试试“← →”键