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

C++ GetConsoleCursorInfo函数代码示例

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

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



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

示例1: _setcursortype

void _setcursortype(int cur_t)
{
    CONSOLE_CURSOR_INFO  ConsoleCursorInfo;

    if (!StdHandle)
    {
        StdHandle = TRUE;
        hStdout = GetStdHandle (STD_OUTPUT_HANDLE);
    } /* endif */

    switch (cur_t)
    {
    case _NORMALCURSOR:
    case _SOLIDCURSOR:
        GetConsoleCursorInfo (hStdout, &ConsoleCursorInfo);
        ConsoleCursorInfo.bVisible = TRUE;
        SetConsoleCursorInfo (hStdout, &ConsoleCursorInfo);
        break;

    case _NOCURSOR:
        GetConsoleCursorInfo (hStdout, &ConsoleCursorInfo);
        ConsoleCursorInfo.bVisible = FALSE;
        SetConsoleCursorInfo (hStdout, &ConsoleCursorInfo);
        break;

    } /* endswitch */
}
开发者ID:bochaqos,项目名称:trmnl,代码行数:27,代码来源:NT_Compatible.c


示例2: RemoveCursor

bool Console::RemoveCursor(void) {
	CONSOLE_CURSOR_INFO cci;
	if (!GetConsoleCursorInfo(hStdOutput, &cci)) return false;
	cci.bVisible = false;
	if (!SetConsoleCursorInfo(hStdOutput, &cci)) return false;
	if (!GetConsoleCursorInfo(hStdError, &cci)) return false;
	cci.bVisible = false;
	if (!SetConsoleCursorInfo(hStdError, &cci)) return false;
	return true;
}
开发者ID:nbei,项目名称:myTetris,代码行数:10,代码来源:console.cpp


示例3: ntconio_open

static void
ntconio_open(void)
{
    CONSOLE_CURSOR_INFO newcci;
    BOOL newcci_ok;

    TRACE(("ntconio_open\n"));

    set_colors(NCOLORS);
    set_palette(initpalettestr);

    hOldConsoleOutput = 0;
    hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
    origcci_ok = GetConsoleCursorInfo(hConsoleOutput, &origcci);
    GetConsoleScreenBufferInfo(hConsoleOutput, &csbi);
    if (csbi.dwMaximumWindowSize.Y !=
	csbi.srWindow.Bottom - csbi.srWindow.Top + 1
	|| csbi.dwMaximumWindowSize.X !=
	csbi.srWindow.Right - csbi.srWindow.Left + 1) {
	TRACE(("..creating alternate screen buffer\n"));
	hOldConsoleOutput = hConsoleOutput;
	hConsoleOutput = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE,
						   0, NULL,
						   CONSOLE_TEXTMODE_BUFFER, NULL);
	SetConsoleActiveScreenBuffer(hConsoleOutput);
	GetConsoleScreenBufferInfo(hConsoleOutput, &csbi);
	newcci_ok = GetConsoleCursorInfo(hConsoleOutput, &newcci);
	if (newcci_ok && origcci_ok && newcci.dwSize != origcci.dwSize) {
	    /*
	     * Ensure that user's cursor size prefs are carried forward
	     * in the newly created console.
	     */
	    show_cursor(TRUE, origcci.dwSize);
	}
    }

    originalAttribute = csbi.wAttributes;

    crow = csbi.dwCursorPosition.Y;
    ccol = csbi.dwCursorPosition.X;

    nfcolor = cfcolor = gfcolor;
    nbcolor = cbcolor = gbcolor;
    set_current_attr();

    newscreensize(csbi.dwMaximumWindowSize.Y, csbi.dwMaximumWindowSize.X);
    hConsoleInput = GetStdHandle(STD_INPUT_HANDLE);
    SetConsoleCtrlHandler(nthandler, TRUE);
}
开发者ID:OS2World,项目名称:APP-EDITOR-Vile,代码行数:49,代码来源:ntconio.c


示例4: drawTable

// draw the field
// argument - width and height of the field
// resizes console window for no reason
// prints instructions how to interact
void drawTable(COORD size)
{
	DWORD cWritten;
	HANDLE con = GetStdHandle(STD_OUTPUT_HANDLE);

	CONSOLE_CURSOR_INFO     cursorInfo;
	GetConsoleCursorInfo(con, &cursorInfo);
	cursorInfo.bVisible = false;
	SetConsoleCursorInfo(con, &cursorInfo);
	
	HWND console = GetConsoleWindow();
	RECT r;
	GetWindowRect(console, &r);
	MoveWindow(console, r.left, r.top, 800, 480, TRUE);

	FillConsoleOutputCharacter(con, '+', 1, { 0, 3 }, &cWritten);
	FillConsoleOutputCharacter(con, '+', 1, { size.X, 3 }, &cWritten);
	FillConsoleOutputCharacter(con, '-', size.X - 1, { 1, 3 }, &cWritten);
	FillConsoleOutputCharacter(con, '_', 4, { 3, 1 }, &cWritten);

	for (int i = 0; i < size.Y; ++i)
	{
		if (i != 3)
		{
			FillConsoleOutputCharacter(con, '|', 1, { 0, i }, &cWritten);
			FillConsoleOutputCharacter(con, '|', 1, { size.X, i }, &cWritten);
		}
	}

	print({size.X + 2, 1}, "COWS AND BULLS");
	print({size.X + 2, 3}, "0-9 - add digit");
	print({size.X + 2, 4}, "Backspace - remove last digit");
	print({size.X + 2, 5}, "Enter - confirm");
	print({size.X + 2, 6}, "Esc - quit");
}
开发者ID:irzen,项目名称:cows_and_bulls,代码行数:39,代码来源:cows_bulls_console.cpp


示例5: hidden

void hidden(){//隐藏光标
	HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
	CONSOLE_CURSOR_INFO cci;
	GetConsoleCursorInfo(hOut, &cci);
	cci.bVisible = 0; //赋1为显示,赋0为隐藏
	SetConsoleCursorInfo(hOut, &cci);
}
开发者ID:hxhb,项目名称:cppcode,代码行数:7,代码来源:maze-game.c


示例6: removeCursor

void removeCursor(void)
{
    CONSOLE_CURSOR_INFO cur;
    GetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cur);
    cur.bVisible=0;
    SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cur);
}
开发者ID:ktk1015,项目名称:tk_test_c,代码行数:7,代码来源:maze.c


示例7: apiPauseConsoleOutput

BOOL apiPauseConsoleOutput(HWND hConWnd, bool bPause)
{
	BOOL bOk = FALSE, bCi = FALSE;
	DWORD_PTR dwRc = 0;
	DWORD nTimeout = 15000;

	if (bPause)
	{
		CONSOLE_CURSOR_INFO ci = {};
		bCi = GetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &ci);

		bOk = (SendMessageTimeout(hConWnd, WM_SYSCOMMAND, 65522, 0, SMTO_NORMAL, nTimeout, &dwRc) != 0);

		// In Win2k we can't be sure about active selection,
		// so we check for cursor height equal to 100%
		gbPauseConsoleWasRequested = (bCi && ci.dwSize < 100);
	}
	else
	{
		bOk = (SendMessageTimeout(hConWnd, WM_KEYDOWN, VK_ESCAPE, 0, SMTO_NORMAL, nTimeout, &dwRc) != 0);
		gbPauseConsoleWasRequested = false;
	}

	return bOk;
}
开发者ID:VladimirTyrin,项目名称:ConEmu,代码行数:25,代码来源:WConsole.cpp


示例8: cursor_visible

 void cursor_visible(bool state){
     static auto handle = GetStdHandle(STD_OUTPUT_HANDLE);
     CONSOLE_CURSOR_INFO     cursorInfo;
     GetConsoleCursorInfo(handle, &cursorInfo);
     cursorInfo.bVisible = state; // set the cursor visibility
     SetConsoleCursorInfo(handle, &cursorInfo);
 }
开发者ID:spartanPAGE,项目名称:spartan-snake-implementation,代码行数:7,代码来源:console-utils.windows.hpp


示例9: GetConsoleCursorInfo

void Graphics::setCursorVisibility(bool isVisible)
{
	CONSOLE_CURSOR_INFO cci;
	GetConsoleCursorInfo(_console, &cci);
	cci.bVisible = isVisible;
	SetConsoleCursorInfo(_console, &cci);
}
开发者ID:GolanSabo,项目名称:Widget,代码行数:7,代码来源:Graphics.cpp


示例10: GetStdHandle

//setting window size and hiding cursor
void Aesthetics::SetWindow(int Width, int Height)
{
	_COORD coord;
	coord.X = Width;
	coord.Y = Height;

	_SMALL_RECT Rect;
	Rect.Top = 0;
	Rect.Left = 0;
	Rect.Bottom = Height - 1;
	Rect.Right = Width - 1;

	HANDLE Handle = GetStdHandle(STD_OUTPUT_HANDLE);      // Get Handle
	SetConsoleScreenBufferSize(Handle, coord);            // Set Buffer Size
	SetConsoleWindowInfo(Handle, TRUE, &Rect);            // Set Window Size


	HANDLE hConsoleOutput;
	CONSOLE_CURSOR_INFO structCursorInfo;
	hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
	GetConsoleCursorInfo(hConsoleOutput, &structCursorInfo);
	structCursorInfo.bVisible = FALSE;
	SetConsoleCursorInfo(hConsoleOutput, &structCursorInfo);

}
开发者ID:jordmax12,项目名称:Cpp2.Spring14,代码行数:26,代码来源:Aesthetics.cpp


示例11: PDC_curs_set

int PDC_curs_set(int visibility)
{
    CONSOLE_CURSOR_INFO cci;
    int ret_vis;

    PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility));

    ret_vis = SP->visibility;

    if (GetConsoleCursorInfo(pdc_con_out, &cci) == FALSE)
        return ERR;

    switch(visibility)
    {
    case 0:             /* invisible */
        cci.bVisible = FALSE;
        break;
    case 2:             /* highly visible */
        cci.bVisible = TRUE;
        cci.dwSize = 95;
        break;
    default:            /* normal visibility */
        cci.bVisible = TRUE;
        cci.dwSize = SP->orig_cursor;
        break;
    }

    if (SetConsoleCursorInfo(pdc_con_out, &cci) == FALSE)
        return ERR;

    SP->visibility = visibility;
    return ret_vis;
}
开发者ID:Bill-Cosby,项目名称:CompSciProject,代码行数:33,代码来源:pdcsetsc.c


示例12: GetConsoleCursorInfo

void WinConsoleHelper::ShowConsoleCursor(bool showFlag)
{
	CONSOLE_CURSOR_INFO cursorInfo;
	GetConsoleCursorInfo(hStdOut, &cursorInfo);
	cursorInfo.bVisible = showFlag;
	SetConsoleCursorInfo(hStdOut, &cursorInfo);
}
开发者ID:FURIBAITO,项目名称:grading-system,代码行数:7,代码来源:win_console_helper.cpp


示例13: _hide_cursor

 void _hide_cursor(HANDLE handle)
 {
   CONSOLE_CURSOR_INFO cci;
   GetConsoleCursorInfo(handle, &cci);
   cci.bVisible = false;
   SetConsoleCursorInfo(handle, &cci);
 }
开发者ID:smarmy,项目名称:HellRogue,代码行数:7,代码来源:sys_win32.cpp


示例14: CursorVisible

// 커서 숨기기 : true, T(보이기), false, F(숨기기)
// 인터넷 참고
void CursorVisible(bool blnCursorVisible)    // Console.CursorVisible = false;
{
    CONSOLE_CURSOR_INFO cursorInfo;
    GetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursorInfo);
    cursorInfo.bVisible = blnCursorVisible;
    SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursorInfo);
}
开发者ID:chcola,项目名称:prUNI,代码行数:9,代码来源:Project.c


示例15: nt_init_term

void nt_init_term(void)
{
	DWORD dwmode;
	CONSOLE_SCREEN_BUFFER_INFO scrbuf;
	HANDLE hinput = GetStdHandle(STD_INPUT_HANDLE);

	if (GetConsoleMode(hinput, &dwmode)) {
		if (!SetConsoleMode(hinput, dwmode | ENABLE_WINDOW_INPUT))
			dbgprintf(PR_ERROR, "!!! %s(): SetConsoleMode(0x%p, ..) error %ld\n", __FUNCTION__, hinput, GetLastError());
	}
	/* defaults */
	glines = 25;
	gcolumns = 80;
	hConOut = CreateFile("CONOUT$", GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
	if (hConOut == INVALID_HANDLE_VALUE) {
		dbgprintf(PR_ERROR, "!!! %s(): CreateFile(\"CONOUT$\", ..) error %ld\n", __FUNCTION__, GetLastError());
		return;
	}
	if (!GetConsoleScreenBufferInfo(hConOut, &scrbuf)) {
		dbgprintf(PR_ERROR, "!!! %s(): GetConsoleScreenBufferInfo(0x%p, ..) error %ld\n", __FUNCTION__, hConOut, GetLastError());
		/* fail all remaining calls */
		hConOut = INVALID_HANDLE_VALUE;
		return;
	}
	if (!GetConsoleCursorInfo(hConOut, &cursinfo))
		dbgprintf(PR_ERROR, "!!! %s(): GetConsoleCursorInfo(0x%p, ..) error %ld\n", __FUNCTION__, hConOut, GetLastError());
        cursinfo_valid = TRUE;
	glines = scrbuf.srWindow.Bottom - scrbuf.srWindow.Top + 1;
	gcolumns = scrbuf.srWindow.Right - scrbuf.srWindow.Left + 1;
}
开发者ID:oldfaber,项目名称:wzsh,代码行数:30,代码来源:tconsole.c


示例16: GetStdHandle

ConsoleImpl::ConsoleImpl()
{
    hndSavedOutput_ = GetStdHandle(STD_OUTPUT_HANDLE);
    GetConsoleScreenBufferInfo(hndSavedOutput_, &csbiSaved_);
    GetConsoleCursorInfo(hndSavedOutput_, &cciSaved_);
    hndOutput_ = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0, NULL, CONSOLE_TEXTMODE_BUFFER, NULL);
}
开发者ID:nythil,项目名称:kgascii,代码行数:7,代码来源:console_win.cpp


示例17: setup_console

/**
 * Prepare console on program initialization: change console font codepage
 * according to program options and hide cursor.
 */
void setup_console(void)
{
	HANDLE hOut;
	CONSOLE_CURSOR_INFO cci;

	int cp = (opt.flags&OPT_UTF8 ? CP_UTF8 : opt.flags&OPT_ANSI ? GetACP() : GetOEMCP());
	rhash_data.saved_console_codepage = -1;
	/* note: we are using numbers 1 = _fileno(stdout), 2 = _fileno(stderr) */
	/* cause _fileno() is undefined,  when compiling as strict ansi C. */
	if(cp > 0 && IsValidCodePage(cp) && (isatty(1) || isatty(2)) )
	{
		rhash_data.saved_console_codepage = GetConsoleOutputCP();
		SetConsoleOutputCP(cp);
		setlocale(LC_CTYPE, opt.flags&OPT_UTF8 ? "C" :
			opt.flags&OPT_ANSI ? ".ACP" : ".OCP");
		rsh_exit = rhash_exit;
	}

	if((opt.flags & OPT_PERCENTS) != 0) {
		hOut = GetStdHandle(STD_ERROR_HANDLE);
		if(hOut != INVALID_HANDLE_VALUE) {
			/* store current cursor size and visibility flag */
			GetConsoleCursorInfo(hOut, &cci);
			rhash_data.saved_cursor_size = (cci.bVisible ? cci.dwSize : 0);

			/* now hide cursor */
			cci.bVisible = 0;
			SetConsoleCursorInfo(hOut, &cci); /* hide cursor */
		}
	}
}
开发者ID:alexander-politov,项目名称:rhash-sdk,代码行数:35,代码来源:win_utils.c


示例18: GetStdHandle

NCursesFrontend::NCursesFrontend()
{
	m_summary = true;
	m_fileList = true;

	m_showNzbname = g_Options->GetCursesNzbName();
	m_showTimestamp = g_Options->GetCursesTime();
	m_groupFiles = g_Options->GetCursesGroup();

	// Setup curses
#ifdef WIN32
	HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);

	CONSOLE_CURSOR_INFO ConsoleCursorInfo;
	GetConsoleCursorInfo(hConsole, &ConsoleCursorInfo);
	ConsoleCursorInfo.bVisible = false;
	SetConsoleCursorInfo(hConsole, &ConsoleCursorInfo);
	if (IsRemoteMode())
	{
		SetConsoleTitle("NZBGet - remote mode");
	}
	else
	{
		SetConsoleTitle("NZBGet");
	}
#else
	m_window = initscr();
	if (m_window == nullptr)
	{
		printf("ERROR: m_pWindow == nullptr\n");
		exit(-1);
	}
	keypad(stdscr, true);
	nodelay((WINDOW*)m_window, true);
	noecho();
	curs_set(0);
	m_useColor = has_colors();
#endif

	if (m_useColor)
	{
#ifndef WIN32
		start_color();
#endif
		init_pair(0,							COLOR_WHITE,	COLOR_BLUE);
		init_pair(NCURSES_COLORPAIR_TEXT,		COLOR_WHITE,	COLOR_BLACK);
		init_pair(NCURSES_COLORPAIR_INFO,		COLOR_GREEN,	COLOR_BLACK);
		init_pair(NCURSES_COLORPAIR_WARNING,	COLOR_MAGENTA,	COLOR_BLACK);
		init_pair(NCURSES_COLORPAIR_ERROR,		COLOR_RED,		COLOR_BLACK);
		init_pair(NCURSES_COLORPAIR_DEBUG,		COLOR_WHITE,	COLOR_BLACK);
		init_pair(NCURSES_COLORPAIR_DETAIL,		COLOR_GREEN,	COLOR_BLACK);
		init_pair(NCURSES_COLORPAIR_STATUS,		COLOR_BLUE,		COLOR_WHITE);
		init_pair(NCURSES_COLORPAIR_KEYBAR,		COLOR_WHITE,	COLOR_BLUE);
		init_pair(NCURSES_COLORPAIR_INFOLINE,	COLOR_WHITE,	COLOR_BLUE);
		init_pair(NCURSES_COLORPAIR_TEXTHIGHL,	COLOR_BLACK,	COLOR_CYAN);
		init_pair(NCURSES_COLORPAIR_CURSOR,		COLOR_BLACK,	COLOR_YELLOW);
		init_pair(NCURSES_COLORPAIR_HINT,		COLOR_WHITE,	COLOR_RED);
	}
}
开发者ID:sanderjo,项目名称:nzbget,代码行数:59,代码来源:NCursesFrontend.cpp


示例19: main

void main()
{
	CONSOLE_SCREEN_BUFFER_INFO csbi = {};
	CONSOLE_CURSOR_INFO ci = {};
	HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
	GetConsoleScreenBufferInfo(hOut, &csbi);
	BOOL lb1 = GetConsoleCursorInfo(hOut, &ci);
	printf("Cursor height before=%i%% (rc=%u)\r\n", ci.dwSize, lb1);
	SetConsoleTitle(_T("Increasing ScreenBufferSize"));
	Sleep(2500);
	csbi.dwSize.X++;
	SetConsoleScreenBufferSize(hOut, csbi.dwSize);
	SetConsoleTitle(_T("Quering current cursor information"));
	Sleep(2500);
	BOOL lb2 = GetConsoleCursorInfo(hOut, &ci);
	printf("Cursor height after=%i%% (rc=%u)\r\n", ci.dwSize, lb2);
}
开发者ID:Maximus5,项目名称:ms-bug-1,代码行数:17,代码来源:incwidth.cpp


示例20: cursorOnOffSwitch

/////////////////////////////////////////////////
// cursorOn(): switches between on/off cursor
void cursorOnOffSwitch()
{
	CONSOLE_CURSOR_INFO cursorInfo;
	HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
	GetConsoleCursorInfo( hStdOut, &cursorInfo);
	
	cursorInfo.bVisible = !cursorInfo.bVisible;
}
开发者ID:langenhagen,项目名称:generic-stuff,代码行数:10,代码来源:consoleBarn.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GetConsoleMode函数代码示例发布时间:2022-05-30
下一篇:
C++ GetConsoleCP函数代码示例发布时间: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