本文整理匯總了C++中FillConsoleOutputCharacter函數的典型用法代碼示例。如果您正苦於以下問題:C++ FillConsoleOutputCharacter函數的具體用法?C++ FillConsoleOutputCharacter怎麽用?C++ FillConsoleOutputCharacter使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了FillConsoleOutputCharacter函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: erase_to_eol
int erase_to_eol( FILE* confp )
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
HANDLE hStdErr;
DWORD dwCellsWritten;
COORD ptConsole;
int cons_fd;
if ( !confp )
{
errno = EINVAL;
return -1;
}
if ( ! _isatty( cons_fd = fileno( confp ) ) )
{
errno = EBADF;
return -1;
}
hStdErr = (HANDLE) _get_osfhandle( cons_fd );
ASSERT( hStdErr && INVALID_HANDLE_VALUE != hStdErr );
VERIFY( GetConsoleScreenBufferInfo( hStdErr, &csbi ) );
ptConsole = csbi.dwCursorPosition;
VERIFY( FillConsoleOutputAttribute( hStdErr, csbi.wAttributes, csbi.dwSize.X - ptConsole.X, ptConsole, &dwCellsWritten ) );
VERIFY( FillConsoleOutputCharacter( hStdErr, ' ', csbi.dwSize.X - ptConsole.X, ptConsole, &dwCellsWritten ) );
return 0;
}
示例2: co_debug
void
console_widget_NT_t::draw()
{
if (console == NULL) {
COORD c = {0, 0};
DWORD z;
if (!FillConsoleOutputCharacter
(buffer, blank.Char.AsciiChar, size.X * size.Y, c, &z))
co_debug("FillConsoleOutputCharacter() error 0x%lx",
GetLastError());
if (!FillConsoleOutputAttribute
(buffer, blank.Attributes, size.X * size.Y, c, &z))
co_debug("FillConsoleOutputAttribute() error 0x%lx",
GetLastError());
return;
}
co_console_cell_t *cell = console->screen;
CHAR_INFO *ci = screen;
int count = size.X * size.Y;
do {
ci->Attributes = cell->attr;
(ci++)->Char.AsciiChar = (cell++)->ch;
} while (--count);
SMALL_RECT r = region;
COORD c = {0, 0};
if (!WriteConsoleOutput(buffer, screen, size, c, &r))
co_debug("WriteConsoleOutput() error 0x%lx", GetLastError());
}
示例3: clear_console
void clear_console(void)
{
#if !defined WINCE
HANDLE Hand;
CONSOLE_SCREEN_BUFFER_INFO Info;
unsigned long Written;
static COORD Home = { 0, 0 };
Hand = GetStdHandle(STD_OUTPUT_HANDLE);
if (Hand == INVALID_HANDLE_VALUE)
return;
if(!GetConsoleScreenBufferInfo(Hand, &Info))
return;
if(!FillConsoleOutputCharacter(Hand, ' ',
Info.dwSize.X * Info.dwSize.Y, Home,
&Written))
return;
if(!FillConsoleOutputAttribute(Hand, Info.wAttributes,
Info.dwSize.X * Info.dwSize.Y, Home,
&Written))
return;
SetConsoleCursorPosition(Hand, Home);
#endif
}
示例4: insline
void insline()
{
int y=wherey() ;
HANDLE hScreen = GetStdHandle(STD_OUTPUT_HANDLE) ;
CONSOLE_SCREEN_BUFFER_INFO Info ;
GetConsoleScreenBufferInfo(hScreen, &Info) ;
{
COORD dwBufferSize={Info.dwSize.X, Info.dwSize.Y - y} ;
COORD dwBufferCoord={0,0} ;
COORD coord={0, y-1} ; // pour FillConsoleOutputCharacter
CHAR_INFO Buffer[dwBufferSize.Y][dwBufferSize.X] ;
DWORD dwWritten;
SMALL_RECT ReadRegion[2] ;
ReadRegion[0].Left = 0 ;
ReadRegion[0].Right = Info.dwSize.X-1 ;
ReadRegion[0].Top = y-1 ;
ReadRegion[0].Bottom = Info.dwSize.Y-2 ;
ReadConsoleOutput(hScreen, (CHAR_INFO*)Buffer, dwBufferSize, dwBufferCoord, ReadRegion) ;
ReadRegion[0].Top = y ;
ReadRegion[0].Bottom = Info.dwSize.Y-1 ;
WriteConsoleOutput(hScreen, (CHAR_INFO*)Buffer, dwBufferSize, dwBufferCoord, ReadRegion) ;
FillConsoleOutputCharacter (hScreen, ' ', Info.dwSize.X, coord, &dwWritten); // Effacer ligne
FillConsoleOutputAttribute (hScreen, Info.wAttributes, Info.dwSize.X, coord, &dwWritten);
}
}
示例5: GetStdHandle
// Initializes windows console.
bool CSimWindow::InitWindow()
{
// Set up console window
WORD wAttributes;
COORD pos;
SMALL_RECT consoleWindowDim;
CONSOLE_SCREEN_BUFFER_INFO bufferInfo;
unsigned long int temp;
// Get console handles
hSimOutput = GetStdHandle(STD_OUTPUT_HANDLE);
hSimInput = GetStdHandle(STD_INPUT_HANDLE);
if(hSimOutput == INVALID_HANDLE_VALUE || hSimInput == INVALID_HANDLE_VALUE) {
printf("ERROR: Couldn't get console I/O handles.\n");
return false;
}
// Save current console info
GetConsoleScreenBufferInfo(hSimOutput, &bufferInfo);
oldBufferSize = bufferInfo.dwSize;
oldWindowSize = bufferInfo.srWindow;
oldAttributes = bufferInfo.wAttributes;
// Set console title
SetConsoleTitle("Emu86 Simulator");
// Set console to small size for buffer change:
consoleWindowDim.Bottom = 0;
consoleWindowDim.Top = 0;
consoleWindowDim.Left = 0;
consoleWindowDim.Right = 0;
SetConsoleWindowInfo(hSimOutput, TRUE, &consoleWindowDim);
// Set buffer size
pos.X = SIM_CONSOLE_BUFFER_WIDTH;
pos.Y = SIM_CONSOLE_BUFFER_HEIGHT;
SetConsoleScreenBufferSize(hSimOutput, pos);
// Set console size
consoleWindowDim.Bottom = SIM_CONSOLE_HEIGHT - 1;
consoleWindowDim.Top = 0;
consoleWindowDim.Left = 0;
consoleWindowDim.Right = SIM_CONSOLE_WIDTH - 1;
SetConsoleWindowInfo(hSimOutput, TRUE, &consoleWindowDim);
// Clear console, set to black, white text
pos.X = 0;
pos.Y = 0;
wAttributes = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
FillConsoleOutputAttribute(hSimOutput, wAttributes, SIM_CONSOLE_BUFFER_WIDTH * SIM_CONSOLE_BUFFER_HEIGHT, pos, &temp);
FillConsoleOutputCharacter(hSimOutput, ' ', SIM_CONSOLE_BUFFER_WIDTH * SIM_CONSOLE_BUFFER_HEIGHT, pos, &temp);
// Move curor to top left
SetConsoleCursorPosition(hSimOutput, pos);
return true;
}
示例6: RefreshScreen
void RefreshScreen(void)
{
DWORD dummy;
COORD Home = {0, 0};
FillConsoleOutputCharacter(hConsoleOut, ' ',
csbiInfo.dwSize.X * csbiInfo.dwSize.Y,
Home, &dummy);
}
示例7: mp_hal_erase_line_from_cursor
void mp_hal_erase_line_from_cursor(uint n_chars_to_erase) {
assure_conout_handle();
CONSOLE_SCREEN_BUFFER_INFO info;
GetConsoleScreenBufferInfo(con_out, &info);
DWORD written;
FillConsoleOutputCharacter(con_out, ' ', n_chars_to_erase, info.dwCursorPosition, &written);
FillConsoleOutputAttribute(con_out, info.wAttributes, n_chars_to_erase, info.dwCursorPosition, &written);
}
示例8: pointerToHandle
JNIEXPORT void JNICALL Java_com_yifanlu_Josh_Josh_FILLCONSOLEOUTPUTCHARACTER
(JNIEnv *env, jclass jcls, jlong pointer, jchar character, jint length, jint x, jint y)
{
HANDLE hConsole = pointerToHandle(pointer);
COORD location = { x , y };
FillConsoleOutputCharacter(hConsole, character, length, location, NULL);
}
示例9: main
int main(int argc, char *argv[])
{
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO bInfo;
GetConsoleScreenBufferInfo(hOut, &bInfo);
COORD pos = {0, 0};
FillConsoleOutputCharacter(hOut, '@', bInfo.dwSize.X / 2 * bInfo.dwSize.Y, pos, NULL);
CloseHandle(hOut);
}
示例10: mp_hal_erase_line_from_cursor
void mp_hal_erase_line_from_cursor() {
assure_conout_handle();
CONSOLE_SCREEN_BUFFER_INFO info;
GetConsoleScreenBufferInfo(con_out, &info);
const short len = info.dwSize.X - info.dwCursorPosition.X;
DWORD written;
FillConsoleOutputCharacter(con_out, ' ', len, info.dwCursorPosition, &written);
FillConsoleOutputAttribute(con_out, info.wAttributes, len, info.dwCursorPosition, &written);
}
示例11: GetConsoleScreenBufferInfo
void Graphics::clearScreen()
{
DWORD d;
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(_console, &csbi);
auto size = csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputAttribute(_console, csbi.wAttributes, size, { 0, 0 }, &d);
FillConsoleOutputCharacter(_console, L' ', size, { 0, 0 }, &d);
}
示例12: info
void Console::Clear(void) const
{
ScreenBufferInfo info(*this); // Screen buffer information
DWORD result; // Result from fill operation
// Fill the console with space characters using the current attibutes; move cursor to 0,0 afterwards
if(!FillConsoleOutputCharacter(m_stdout, _T(' '), info.dwSize.X * info.dwSize.Y, { 0, 0 }, &result)) throw Win32Exception();
if(!FillConsoleOutputAttribute(m_stdout, info.wAttributes, info.dwSize.X * info.dwSize.Y, { 0, 0 }, &result)) throw Win32Exception();
if(!SetConsoleCursorPosition(m_stdout, { 0, 0 })) throw Win32Exception();
}
示例13: eraseEol
static void eraseEol(struct current *current)
{
COORD pos;
DWORD n;
pos.X = (SHORT) current->x;
pos.Y = (SHORT) current->y;
FillConsoleOutputCharacter(current->outh, ' ', current->cols - current->x, pos, &n);
}
示例14: FillConsoleOutputAttribute
void clib::cls()
{
_COORD st;
unsigned long bw;
st.X = 0;
st.Y = 0;
FillConsoleOutputAttribute(screen_,fgc_|bgc_,80*50,st,&bw);
FillConsoleOutputCharacter(screen_,32,80*50,st,&bw);
SetConsoleCursorPosition(screen_,st);
}
示例15: ClearLine
void ClearLine(void) {
CONSOLE_SCREEN_BUFFER_INFO s;
HANDLE out = GetTermInfo(&s);
COORD pos = { 0, s.dwCursorPosition.Y };
DWORD n;
FillConsoleOutputCharacter(out, ' ', s.dwSize.X, pos, (LPDWORD)(&n));
SetConsoleCursorPosition(out, pos);
}