- May
- 13,718
- 206
This happened:
g:\projects\4console\release> vbeep 3asteri 7
Usage : TITLE [/P] title
And here's the code that produced it:
INT WINAPI VBEEP ( WCHAR *psz )
{
if ( wcsstr(psz, L"/?") )
{
Printf(L"%s\r\n", item[ivbeep].Help);
return 0;
}
COORD cdZero = {0, 0};
DWORD dwWritten, dwDuration = 0, dwFreq = 0;
WCHAR junk[32] = L"";
Sscanf(psz, L" %s %u", junk, &dwDuration);
CONSOLE_CURSOR_INFO cci = {1, FALSE};
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(STD_OUT, &csbi);
HANDLE hBlink = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0,
NULL, CONSOLE_TEXTMODE_BUFFER, NULL);
HANDLE hSave = STD_OUT;
WORD dbga = ((csbi.wAttributes & 0x00f0) >> 4) | ((csbi.wAttributes & 0x000f) << 4);
SetConsoleTextAttribute(hBlink, dbga);
SetConsoleCursorInfo(hBlink, &cci);
SetConsoleScreenBufferSize(hBlink, csbi.dwSize);
SetConsoleWindowInfo(hBlink, TRUE, &csbi.srWindow);
SetConsoleScreenBufferSize(hBlink, csbi.dwSize);
GetConsoleScreenBufferInfo(hBlink, &csbi);
FillConsoleOutputAttribute(hBlink, dbga,
(csbi.dwSize.X) * (csbi.srWindow.Bottom - csbi.srWindow.Top + 1),
cdZero, &dwWritten);
SetConsoleActiveScreenBuffer(hBlink);
Beep_Cmd(psz);
if ( junk[0] > L'9' )
Sleep(dwDuration ? dwDuration * 1000 / 18 : 300);
SetConsoleActiveScreenBuffer(hSave);
CloseHandle(hBlink);
return 0;
It's not 100% reproducible. Sometimes I get (the expected)
g:\projects\4console\release> vbeep 3asteri 7
Usage : BEEP [ASTERISK | EXCLAMATION | HAND | OK | QUESTION] [frequency duration
...]
And note, UpdateTitle=No.
g:\projects\4console\release> vbeep 3asteri 7
Usage : TITLE [/P] title
And here's the code that produced it:
INT WINAPI VBEEP ( WCHAR *psz )
{
if ( wcsstr(psz, L"/?") )
{
Printf(L"%s\r\n", item[ivbeep].Help);
return 0;
}
COORD cdZero = {0, 0};
DWORD dwWritten, dwDuration = 0, dwFreq = 0;
WCHAR junk[32] = L"";
Sscanf(psz, L" %s %u", junk, &dwDuration);
CONSOLE_CURSOR_INFO cci = {1, FALSE};
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(STD_OUT, &csbi);
HANDLE hBlink = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0,
NULL, CONSOLE_TEXTMODE_BUFFER, NULL);
HANDLE hSave = STD_OUT;
WORD dbga = ((csbi.wAttributes & 0x00f0) >> 4) | ((csbi.wAttributes & 0x000f) << 4);
SetConsoleTextAttribute(hBlink, dbga);
SetConsoleCursorInfo(hBlink, &cci);
SetConsoleScreenBufferSize(hBlink, csbi.dwSize);
SetConsoleWindowInfo(hBlink, TRUE, &csbi.srWindow);
SetConsoleScreenBufferSize(hBlink, csbi.dwSize);
GetConsoleScreenBufferInfo(hBlink, &csbi);
FillConsoleOutputAttribute(hBlink, dbga,
(csbi.dwSize.X) * (csbi.srWindow.Bottom - csbi.srWindow.Top + 1),
cdZero, &dwWritten);
SetConsoleActiveScreenBuffer(hBlink);
Beep_Cmd(psz);
if ( junk[0] > L'9' )
Sleep(dwDuration ? dwDuration * 1000 / 18 : 300);
SetConsoleActiveScreenBuffer(hSave);
CloseHandle(hBlink);
return 0;
It's not 100% reproducible. Sometimes I get (the expected)
g:\projects\4console\release> vbeep 3asteri 7
Usage : BEEP [ASTERISK | EXCLAMATION | HAND | OK | QUESTION] [frequency duration
...]
And note, UpdateTitle=No.