• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FillConsoleOutputAttribute函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FillConsoleOutputAttribute函数的典型用法代码示例。如果您正苦于以下问题:C++ FillConsoleOutputAttribute函数的具体用法?C++ FillConsoleOutputAttribute怎么用?C++ FillConsoleOutputAttribute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FillConsoleOutputAttribute函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: clrscr

void clrscr() {
	HANDLE hConsole = GetStdHandle( STD_OUTPUT_HANDLE );
	COORD coordScreen = { 0, 0 };
	CONSOLE_SCREEN_BUFFER_INFO csbi;
	GetConsoleScreenBufferInfo( hConsole, &csbi );
	DWORD dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
	DWORD cCharsWritten;
	FillConsoleOutputCharacter( hConsole, (TCHAR) ' ', dwConSize, coordScreen, &cCharsWritten );
	GetConsoleScreenBufferInfo( hConsole, &csbi );
	FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten );
	SetConsoleCursorPosition( hConsole, coordScreen );
}
开发者ID:zsimpson,项目名称:zbslib,代码行数:12,代码来源:zvidcap.cpp


示例2: Clear

// clear the console window
void Clear(HANDLE hOut)
{
	CONSOLE_SCREEN_BUFFER_INFO bufInfo;
	static COORD const zero = { 0, 0 };
	DWORD written;
	DWORD size;
	GetConsoleScreenBufferInfo(hOut, &bufInfo);
	size = bufInfo.dwSize.X * bufInfo.dwSize.Y;
	FillConsoleOutputCharacter(hOut, 0, size, zero, &written);
	FillConsoleOutputAttribute(hOut, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE, size, zero, &written);
	SetConsoleCursorPosition(hOut, zero);
}
开发者ID:eriser,项目名称:mini-synth-1,代码行数:13,代码来源:Console.cpp


示例3: clearScreen

static void clearScreen(struct current *current)
{
    COORD topleft = { 0, 0 };
    DWORD n;

    FillConsoleOutputCharacter(current->outh, ' ',
        current->cols * current->rows, topleft, &n);
    FillConsoleOutputAttribute(current->outh,
        FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN,
        current->cols * current->rows, topleft, &n);
    SetConsoleCursorPosition(current->outh, topleft);
}
开发者ID:pvanek,项目名称:linenoise,代码行数:12,代码来源:linenoise.c


示例4: GetStdHandle

	bool CHaloPrintStream::Write(const std::wstring& str)// str usually has endl appended
	{
		if (str.size() == 0) return true;
		
		bool ready = *(bool*)UlongToPtr(ADDR_CONSOLEREADY);
		if (!ready) {
			std::wcout << str;
			return true;
		}
		// Prepare for writing the string
		HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
		DWORD written = 0;

		CONSOLE_SCREEN_BUFFER_INFO info;
		SHORT oldX = 0; // used to set cursor back to old position

		// Get current console position info
		GetConsoleScreenBufferInfo(hConsole, &info);
		oldX = info.dwCursorPosition.X;

		// Set cursor to start of the last row (where we want to start writing)
		info.dwCursorPosition.X = 0;
		info.dwCursorPosition.Y = 299;
		SetConsoleCursorPosition(hConsole, info.dwCursorPosition);

		FillConsoleOutputCharacterA(hConsole, ' ', 95, info.dwCursorPosition, &written);
		FillConsoleOutputAttribute(hConsole, 7, 95, info.dwCursorPosition, &written);

		// Write the text
		WriteConsoleW(hConsole, str.c_str(), str.size(), &written, NULL);
		//WriteConsoleW(hConsole, L"\n", 1, &written, NULL);

		// Get the current text in the console
		LPBYTE ptr = (LPBYTE)ADDR_CONSOLEINFO;

		if (*ptr != 0) {
			// Build current command input
			std::string formatted = "halo( ";

			formatted += (char*)UlongToPtr(*(DWORD*)ptr + OFFSET_CONSOLETEXT); // current text

			// Rewrite the data to console
			GetConsoleScreenBufferInfo(hConsole, &info);
			FillConsoleOutputCharacterA(hConsole, ' ', 95, info.dwCursorPosition, &written);
			WriteConsoleOutputCharacterA(hConsole, formatted.c_str(), formatted.size(), info.dwCursorPosition, &written);

			// Set the cursor to its old position
			GetConsoleScreenBufferInfo(hConsole, &info);
			info.dwCursorPosition.X = oldX;
			SetConsoleCursorPosition(hConsole, info.dwCursorPosition);
		}
		return true;
	}
开发者ID:eliteprime,项目名称:Phasor,代码行数:53,代码来源:HaloStreams.cpp


示例5: SetBackgroundColour

	void Console::SwitchBackgroundColour( const int colour )
	{
		SetBackgroundColour(colour);
		// Number of cells in current buffer
		int console_size = mConsoleInfo.dwSize.X * mConsoleInfo.dwSize.Y;

		DWORD cCharsWritten;
		COORD coordScreen = { 0, 0 };
		GetConsoleScreenBufferInfo(mConsoleHandle, &mConsoleInfo);
		// Set buffer attributes
		FillConsoleOutputAttribute( mConsoleHandle, mConsoleInfo.wAttributes,
			console_size, coordScreen, &cCharsWritten );
	}
开发者ID:jennmat,项目名称:Cinch,代码行数:13,代码来源:console.cpp


示例6: findCursorPos

// Erases everything from the cursor position to the end
bool Console::eraseFromCursorToEnd(void)
{
	cout.flush();
	findCursorPos();
	DWORD numCharactersWritten;
	COORD consoleCoords = {xPos, yPos};
	FillConsoleOutputCharacter(consoleHandle, ' ', (25 - yPos) * 80 + (80 - xPos), consoleCoords, &numCharactersWritten);
	FillConsoleOutputAttribute(consoleHandle, consoleInfo.wAttributes, (25 - yPos) * 80 + (80 - xPos), consoleCoords, &numCharactersWritten);
	setCursorPos(xPos, yPos);
	cout.flush();
	
	return true;
}
开发者ID:watertoeast,项目名称:telnet,代码行数:14,代码来源:Console.cpp


示例7: DrawFileSystemList

VOID
DrawFileSystemList(
    IN PFILE_SYSTEM_LIST List)
{
    PLIST_ENTRY ListEntry;
    PFILE_SYSTEM_ITEM Item;
    COORD coPos;
    DWORD Written;
    ULONG Index = 0;
    CHAR Buffer[70];

    ListEntry = List->ListHead.Flink;
    while (ListEntry != &List->ListHead)
    {
        Item = CONTAINING_RECORD(ListEntry, FILE_SYSTEM_ITEM, ListEntry);

        coPos.X = List->Left;
        coPos.Y = List->Top + (SHORT)Index;
        FillConsoleOutputAttribute(StdOutput,
                                   FOREGROUND_WHITE | BACKGROUND_BLUE,
                                   sizeof(Buffer),
                                   coPos,
                                   &Written);
        FillConsoleOutputCharacterA(StdOutput,
                                    ' ',
                                    sizeof(Buffer),
                                    coPos,
                                    &Written);

        if (Item->FileSystemName)
        {
            if (Item->QuickFormat)
                snprintf(Buffer, sizeof(Buffer), MUIGetString(STRING_FORMATDISK1), Item->FileSystemName);
            else
                snprintf(Buffer, sizeof(Buffer), MUIGetString(STRING_FORMATDISK2), Item->FileSystemName);
        }
        else
            snprintf(Buffer, sizeof(Buffer), MUIGetString(STRING_KEEPFORMAT));

        if (ListEntry == &List->Selected->ListEntry)
            CONSOLE_SetInvertedTextXY(List->Left,
                                      List->Top + (SHORT)Index,
                                      Buffer);
        else
            CONSOLE_SetTextXY(List->Left,
                              List->Top + (SHORT)Index,
                              Buffer);
        Index++;
        ListEntry = ListEntry->Flink;
    }
}
开发者ID:crank123,项目名称:reactos,代码行数:51,代码来源:fslist.c


示例8: clrscr

 void clrscr ( void ) // efface l'écran
 {
 HANDLE hstdout = STDOUT;
 CONSOLE_SCREEN_BUFFER_INFO csbi;
 if (GetConsoleScreenBufferInfo (hstdout, &csbi))
 {
     COORD coordScreen = { 0, 0 };
     DWORD cCharsWritten;
     DWORD dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
     FillConsoleOutputCharacter (hstdout, ' ', dwConSize, coordScreen, &cCharsWritten);
     FillConsoleOutputAttribute (hstdout, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
     SetConsoleCursorPosition    (hstdout, coordScreen);
 }
 }
开发者ID:NitriKx,项目名称:IUT-CPP-Projet,代码行数:14,代码来源:econio.cpp


示例9: setCursorPos

// Clears the entire screen
bool Console::clearScreen(void)
{
	cout.flush();
	setCursorPos(0, 0);
	DWORD numCharactersWritten;
	COORD consoleCoords = {0, 0};
    GetConsoleScreenBufferInfo(consoleHandle, &consoleInfo);
    FillConsoleOutputCharacter(consoleHandle, ' ', consoleInfo.dwSize.X * consoleInfo.dwSize.Y, consoleCoords, &numCharactersWritten);
	FillConsoleOutputAttribute(consoleHandle, consoleInfo.wAttributes, consoleInfo.dwSize.X * consoleInfo.dwSize.Y, consoleCoords, &numCharactersWritten);
	setCursorPos(0, 0);
	cout.flush();

	return true;
}
开发者ID:watertoeast,项目名称:telnet,代码行数:15,代码来源:Console.cpp


示例10: xsetupconsole

LVAL xsetupconsole()
{
    HWND mywin;
    HANDLE myhandle;
    COORD winsize, origin;
    WORD textattrib;
    DWORD n;
    mywin = GetForegroundWindow();
    SetConsoleTitle("Nyquist");

    myhandle = GetStdHandle(STD_OUTPUT_HANDLE);
    origin.X = 0;
    origin.Y = 0;
    winsize.X = 100;
    winsize.Y = 40;
    textattrib = BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_INTENSITY;

    FillConsoleOutputAttribute(myhandle, textattrib, winsize.X * winsize.Y, origin, &n);
    SetConsoleScreenBufferSize(myhandle, winsize);
    FillConsoleOutputAttribute(myhandle, textattrib, winsize.X * winsize.Y, origin, &n);
    SetConsoleTextAttribute(myhandle, textattrib);
    return NIL;
}
开发者ID:lackofentropy,项目名称:nyquist,代码行数:23,代码来源:winfun.c


示例11: ClearScreen

// clear console screen
void ClearScreen() {
	COORD coordScreen = { 0, 0 };
	DWORD cCharsWritten;
	CONSOLE_SCREEN_BUFFER_INFO csbi;
	DWORD dwConSize;
	HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);

	GetConsoleScreenBufferInfo(hConsole, &csbi);
	dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
	FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten);
	GetConsoleScreenBufferInfo(hConsole, &csbi);
	FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
	SetConsoleCursorPosition(hConsole, coordScreen);
}
开发者ID:john-peterson,项目名称:john-peterson,代码行数:15,代码来源:common.cpp


示例12: scroll_to_top

void scroll_to_top(CONSOLE_SCREEN_BUFFER_INFO &csbi)
{
	COORD topLeft = { 0, 0 };
	HANDLE hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE);
	DWORD written;
	GetConsoleScreenBufferInfo(hConsoleOut, &csbi);

	FillConsoleOutputCharacterA(hConsoleOut, ' ', csbi.dwSize.X * csbi.dwSize.Y, topLeft, &written);
	FillConsoleOutputAttribute(hConsoleOut, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE,
		csbi.dwSize.X * csbi.dwSize.Y, topLeft, &written);

	SetConsoleCursorPosition(hConsoleOut, topLeft);

}
开发者ID:coconaut,项目名称:ntsy,代码行数:14,代码来源:console.cpp


示例13: WCEL_Update

static inline void WCEL_Update(WCEL_Context* ctx, int beg, int len)
{
    int         i, last;
    DWORD       count;
    WCHAR       tmp[2];

    /* bare console case is handled in CONSOLE_ReadLine (we always reprint the whole string) */
    if (!ctx->shall_echo || !ctx->can_pos_cursor) return;

    for (i = last = beg; i < beg + len; i++)
    {
        if (ctx->line[i] < ' ')
        {
            if (last != i)
            {
                WriteConsoleOutputCharacterW(ctx->hConOut, &ctx->line[last], i - last,
                                             WCEL_GetCoord(ctx, last), &count);
                FillConsoleOutputAttribute(ctx->hConOut, ctx->csbi.wAttributes, i - last,
                                           WCEL_GetCoord(ctx, last), &count);
            }
            tmp[0] = '^';
            tmp[1] = '@' + ctx->line[i];
            WriteConsoleOutputCharacterW(ctx->hConOut, tmp, 2,
                                         WCEL_GetCoord(ctx, i), &count);
            FillConsoleOutputAttribute(ctx->hConOut, ctx->csbi.wAttributes, 2,
                                       WCEL_GetCoord(ctx, i), &count);
            last = i + 1;
        }
    }
    if (last != beg + len)
    {
        WriteConsoleOutputCharacterW(ctx->hConOut, &ctx->line[last], i - last,
                                     WCEL_GetCoord(ctx, last), &count);
        FillConsoleOutputAttribute(ctx->hConOut, ctx->csbi.wAttributes, i - last,
                                   WCEL_GetCoord(ctx, last), &count);
    }
}
开发者ID:alantsev,项目名称:wine,代码行数:37,代码来源:editline.c


示例14: cls

void Console::cls()
{
   COORD coordScreen = { 0, 0 };    // home for the cursor 
   DWORD cCharsWritten;
   CONSOLE_SCREEN_BUFFER_INFO csbi; 
   DWORD dwConSize;

// Get the number of character cells in the current buffer. 

   if( !GetConsoleScreenBufferInfo( hConsole, &csbi ))
   {
      return;
   }

   dwConSize = csbi.dwSize.X * csbi.dwSize.Y;

   // Fill the entire screen with blanks.

   if( !FillConsoleOutputCharacter( hConsole,        // Handle to console screen buffer 
                                    (TCHAR) ' ',     // Character to write to the buffer
                                    dwConSize,       // Number of cells to write 
                                    coordScreen,     // Coordinates of first cell 
                                    &cCharsWritten ))// Receive number of characters written
   {
      return;
   }

   // Get the current text attribute.

   if( !GetConsoleScreenBufferInfo( hConsole, &csbi ))
   {
      return;
   }

   // Set the buffer's attributes accordingly.

   if( !FillConsoleOutputAttribute( hConsole,         // Handle to console screen buffer 
                                    csbi.wAttributes, // Character attributes to use
                                    dwConSize,        // Number of cells to set attribute 
                                    coordScreen,      // Coordinates of first cell 
                                    &cCharsWritten )) // Receive number of characters written
   {
      return;
   }

   // Put the cursor at its home coordinates.

   SetConsoleCursorPosition( hConsole, coordScreen );
}
开发者ID:justthom8,项目名称:MyProjects,代码行数:49,代码来源:Console.cpp


示例15: erase_at

static void
erase_at(COORD coordCursor, int length)
{
    W32_CHAR blank = ' ';
    DWORD written;

    FillConsoleOutputCharacter(
				  hConsoleOutput, blank, length,
				  coordCursor, &written
	);
    FillConsoleOutputAttribute(
				  hConsoleOutput, currentAttribute, length,
				  coordCursor, &written
	);
}
开发者ID:OS2World,项目名称:APP-EDITOR-Vile,代码行数:15,代码来源:ntconio.c


示例16: GetConsoleScreenBufferInfo

void Console::clear()
{
	// Description: Clears the screen
	COORD coordScreen = { 0, 0 };
	DWORD cCharsWritten;
	DWORD dwConSize;
	CONSOLE_SCREEN_BUFFER_INFO csbi;
	GetConsoleScreenBufferInfo(hConsole, &csbi);
	dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
	FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten);
	GetConsoleScreenBufferInfo(hConsole, &csbi);
	FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
	SetConsoleCursorPosition(hConsole, coordScreen);

};
开发者ID:cassas00,项目名称:Zombie-vs-Human,代码行数:15,代码来源:Console.cpp


示例17: clear_screen

void clear_screen()
{
#ifdef _WIN32
	HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);

	COORD c = {0, 0};
	CONSOLE_SCREEN_BUFFER_INFO si;
	GetConsoleScreenBufferInfo(out, &si);
	DWORD n;
	FillConsoleOutputCharacter(out, ' ', si.dwSize.X * si.dwSize.Y, c, &n);
	FillConsoleOutputAttribute(out, 0x7, si.dwSize.X * si.dwSize.Y, c, &n);
#else
	std::printf("\033[2J");
#endif
}
开发者ID:poltina,项目名称:libtorrent,代码行数:15,代码来源:print.cpp


示例18: MyCls

void MyCls(HANDLE hConsole) 
{
    COORD   coordScreen={0,0};//设置清屏后光标返回的屏幕左上角坐标
    BOOL	bSuccess;   
    DWORD   cCharsWritten;   
    CONSOLE_SCREEN_BUFFER_INFO   csbi;//保存缓冲区信息   
    DWORD   dwConSize;//当前缓冲区可容纳的字符数   
    bSuccess=GetConsoleScreenBufferInfo(hConsole,&csbi);//获得缓冲区信息   
    dwConSize=csbi.dwSize.X*csbi.dwSize.Y;//缓冲区容纳字符数目   
    bSuccess=FillConsoleOutputCharacter(hConsole,(TCHAR)' ',dwConSize,coordScreen,&cCharsWritten);   
    bSuccess=GetConsoleScreenBufferInfo(hConsole,&csbi);//获得缓冲区信息   
    bSuccess=FillConsoleOutputAttribute(hConsole,csbi.wAttributes,dwConSize,coordScreen,&cCharsWritten);   
    bSuccess=SetConsoleCursorPosition(hConsole,coordScreen);   
    return;
}
开发者ID:340211173,项目名称:LookDrvCode,代码行数:15,代码来源:main.cpp


示例19: clear

static void clear(HANDLE hConsole) {
	COORD coordScreen = { 0, 0 };    // here's where we'll home the cursor 
	BOOL bSuccess;
	DWORD cCharsWritten;
	CONSOLE_SCREEN_BUFFER_INFO csbi; // to get buffer info 
	DWORD dwConSize;                 // number of character cells in the current buffer 

	bSuccess = GetConsoleScreenBufferInfo(hConsole, &csbi);  // get the number of character cells in the current buffer
	dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
	bSuccess = FillConsoleOutputCharacter(hConsole, (TCHAR)' ', dwConSize, coordScreen, &cCharsWritten);  // fill the entire screen with blanks
	bSuccess = GetConsoleScreenBufferInfo(hConsole, &csbi); // get the current text attribute
	bSuccess = FillConsoleOutputAttribute(hConsole, csbi.wAttributes,	dwConSize, coordScreen, &cCharsWritten); // now set the buffer's attributes accordingly 
	bSuccess = SetConsoleCursorPosition(hConsole, coordScreen); // put the cursor at (0, 0)
	return;
}
开发者ID:dutt,项目名称:sects,代码行数:15,代码来源:windowmgr.cpp


示例20: WriteConsoleLine

BOOL
WriteConsoleLine(
    HANDLE OutputHandle,
    WORD LineNumber,
    LPSTR Text,
    BOOL Highlight
)
{
    COORD WriteCoord;
    DWORD NumberWritten;
    DWORD TextLength;

    WriteCoord.X = 0;
    WriteCoord.Y = LineNumber;
    if (!FillConsoleOutputCharacter( OutputHandle,
                                     ' ',
                                     NumberOfCols,
                                     WriteCoord,
                                     &NumberWritten
                                   )
       ) {
        return FALSE;
    }

#if 0
    if (!FillConsoleOutputAttribute( OutputHandle,
                                     (WORD)(Highlight ? HighlightAttribute : NormalAttribute),
                                     NumberOfCols,
                                     WriteCoord,
                                     &NumberWritten
                                   )
       ) {
        return FALSE;
    }

#endif
    if (Text == NULL || (TextLength = strlen( Text )) == 0) {
        return TRUE;
    }
    else {
        return WriteConsoleOutputCharacter( OutputHandle,
                                            Text,
                                            TextLength,
                                            WriteCoord,
                                            &NumberWritten
                                          );
    }
}
开发者ID:shuowen,项目名称:OpenNT,代码行数:48,代码来源:pmon.c



注:本文中的FillConsoleOutputAttribute函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FillConsoleOutputCharacter函数代码示例发布时间:2022-05-30
下一篇:
C++ FillBuffer函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap