当前位置: 首页>>代码示例>>C++>>正文


C++ GetConsoleCursorInfo函数代码示例

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


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


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