您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ AttachConsole函数代码示例

51自学网 2021-06-01 19:48:10
  C++
这篇教程C++ AttachConsole函数代码示例写得很实用,希望能帮到您。

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

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

示例1: LaunchedFromConsole

BOOL LaunchedFromConsole(void) {  if (!AttachConsole(ATTACH_PARENT_PROCESS)) {    return FALSE;  } else {    return TRUE;  }}
开发者ID:meh,项目名称:MSYS2-packages,代码行数:7,


示例2: WinMain

int APIENTRYWinMain(HINSTANCE hInstance1,	HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){    static char name0[256];    static char *argv[256];    int argc = 1;    int i;    GetModuleFileName(hInstance1, name0, 256);    /* Allocate everything virtually - be on the safe side */    argv[0] = strdup(name0);    lpCmdLine = strdup(lpCmdLine);    for (i = 0; lpCmdLine[i]; i++) {	if (lpCmdLine[i] == ' ' || lpCmdLine[i] == '/t')	    lpCmdLine[i] = 0;	else if (!i || !lpCmdLine[i - 1])	    argv[argc] = lpCmdLine + i, argc++;    }    /* Attach to parent console if available so output will be visible */    if (AttachConsole(ATTACH_PARENT_PROCESS)) {	/* make sure stdout is not already redirected before redefining */	if (_fileno(stdout) == -1 || _get_osfhandle(fileno(stdout)) == -1)	    freopen("CON", "w", stdout);    }    hInstance = hInstance1;    return XaoS_main(argc, argv);}
开发者ID:Azizou,项目名称:XaoS,代码行数:31,


示例3: attach_parent_console

static void attach_parent_console(){	BOOL outRedirected, errRedirected;	outRedirected = IsHandleRedirected(STD_OUTPUT_HANDLE);	errRedirected = IsHandleRedirected(STD_ERROR_HANDLE);	if (outRedirected && errRedirected) {		/* Both standard output and error handles are redirected.		 * There is no point in attaching to parent process console.		 */		return;	}	if (AttachConsole(ATTACH_PARENT_PROCESS) == 0) {		/* Console attach failed. */		return;	}	/* Console attach succeeded */	if (outRedirected == FALSE) {		freopen("CONOUT$", "w", stdout);	}	if (errRedirected == FALSE) {		freopen("CONOUT$", "w", stderr);	}}
开发者ID:HappyerKing,项目名称:wireshark,代码行数:28,


示例4: attach_console

void attach_console(){   bool attached = AttachConsole(ATTACH_PARENT_PROCESS) != 0;   // Only force attach when running a debug build#if !defined(NDEBUG)   if (!attached)   {      attached = AllocConsole() != 0;   }#endif   // re-open standard file streams.   // Note, that due to a known bug in the Windows CRT these streams cannot   // be redirected on the command line using the > operator. This is a known   // bug in the Windows CRT and is NOT a defect of this application!   if (attached)   {      freopen("CON", "w", stdout);      freopen("CON", "r", stdin);      freopen("CON", "w", stderr);   }}
开发者ID:evilrix,项目名称:sweetie-rush,代码行数:25,


示例5: terminal_init

int terminal_init(void){    if (AttachConsole(ATTACH_PARENT_PROCESS)) {        // We have been started by something with a console window.        // Redirect output streams to that console's low-level handles,        // so we can actually use WriteConsole later on.        int hConHandle;        hConHandle = _open_osfhandle((intptr_t)hSTDOUT, _O_TEXT);        *stdout = *_fdopen(hConHandle, "w");        setvbuf(stdout, NULL, _IONBF, 0);        hConHandle = _open_osfhandle((intptr_t)hSTDERR, _O_TEXT);        *stderr = *_fdopen(hConHandle, "w");        setvbuf(stderr, NULL, _IONBF, 0);    }    CONSOLE_SCREEN_BUFFER_INFO cinfo;    DWORD cmode = 0;    GetConsoleMode(hSTDOUT, &cmode);    cmode |= (ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);    SetConsoleMode(hSTDOUT, cmode);    SetConsoleMode(hSTDERR, cmode);    GetConsoleScreenBufferInfo(hSTDOUT, &cinfo);    stdoutAttrs = cinfo.wAttributes;    return 0;}
开发者ID:LiminWang,项目名称:mpv,代码行数:28,


示例6: wWinMain

int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpstrCmdLine, int nCmdShow ){	AttachConsole(ATTACH_PARENT_PROCESS);	int argc;	wchar_t *const *argv=CommandLineToArgvW(lpstrCmdLine,&argc);	if (!argv) return 1;	if (argc==3)	{		if (_wcsicmp(argv[0],L"extract")==0)		{			// extract DLL, CSV			// extracts the string table, the dialog text, and the L10N text from a DLL and stores it in a CSV			return ExtractStrings(argv[1],argv[2]);		}		if (_wcsicmp(argv[0],L"import")==0)		{			// import DLL, CSV			// replaces the string table in the DLL with the text from the CSV			return ImportStrings(argv[1],argv[2]);		}	}	return 0;}
开发者ID:madnessw,项目名称:thesnow,代码行数:26,


示例7: SDLAppAttachToConsole

bool SDLAppAttachToConsole() {    if(using_parent_console)      return true;    if(gSDLAppConsoleWindow != 0) return false;    // if TERM is set to msys, try and attach to console    // could possibly add other supported TERMs here if there are any    char* term = getenv("TERM");    if(!term || strcmp(term, "msys")!=0) return false;    if(AttachConsole(ATTACH_PARENT_PROCESS)) {        // send stdout to console unless already redirected        if (_fileno(stdout) == -1 || _get_osfhandle(fileno(stdout)) == -1) {            freopen("conout$","w", stdout);        }        // send stderr to console unless already redirected        if (_fileno(stderr) == -1 || _get_osfhandle(fileno(stderr)) == -1) {            freopen("conout$","w", stderr);        }        using_parent_console = true;    }    return using_parent_console;}
开发者ID:JickLee,项目名称:Core,代码行数:27,


示例8: AppMain

int AppMain(int argc, char **argv){    CharacterMode = RGui;    if(strcmp(getDLLVersion(), getRVersion()) != 0) {	MessageBox(0, "R.DLL version does not match", "Terminating",		   MB_TASKMODAL | MB_ICONSTOP | MB_OK);	exit(1);    }    cmdlineoptions(argc, argv);    if (!setupui()) {        MessageBox(0, "Error setting up console.  Try --vanilla option.",                      "Terminating", MB_TASKMODAL | MB_ICONSTOP | MB_OK);        GA_exitapp();    }/* C writes to stdout/stderr get set to the launching terminal (if   there was one).  Needs XP, and works for C but not Fortran. */    if (AttachConsole(ATTACH_PARENT_PROCESS))    {	freopen("CONIN$", "r", stdin);	freopen("CONOUT$", "w", stdout);	freopen("CONOUT$", "w", stderr);    }    Rf_mainloop();    /* NOTREACHED */    return 0;}
开发者ID:edzer,项目名称:cxxr,代码行数:29,


示例9: searchForProcess

void AttachToRLLog::tryConsoleConnection(){    if (!consoleConnected) {        consoleConnected = false;        RLProcID = searchForProcess(RL);        linesRead = 0;        if (threadFound) {            std::cout << "AttachToRLLog::tryConsoleConnection - attaching to console" << std::endl;            if (AttachConsole(RLProcID))            {                    hConsole = CreateFile(L"CONOUT$",                        GENERIC_READ | GENERIC_WRITE,                        0, 0, OPEN_EXISTING, 0, 0);                    consoleConnected = true;                    emit rocketLeagueRunning(true);                    scanLogTimer = new QTimer(this);                    connect(scanLogTimer, SIGNAL(timeout()), this, SLOT(readLatest()));                    scanLogTimer->start(100);            }            else            {                std::cout << "AttachToRLLOG: connection to console failed" << std::endl;                QTimer::singleShot(1000, Qt::CoarseTimer, this, SLOT(tryConsoleConnection()));            }        } else {            QTimer::singleShot(1000, Qt::CoarseTimer, this, SLOT(tryConsoleConnection()));        }    }}
开发者ID:FireFlyForLife,项目名称:Rocket-League-Chroma-Control,代码行数:30,


示例10: CheckMounted

void Drive::Umount(HWND){	// check mounted	CheckMounted();//	if (GetDriveType(mnt) == DRIVE_NO_ROOT_DIR)//		mounted = false;	if (!mounted)		throw truntime_error(_T("Cannot unmount a not mounted drive"));	// unmount	fuse_unmount(wchar_to_utf8_cstr(mnt).c_str(), NULL);	if (subProcess) {		// attach console to allow sending ctrl-c		AttachConsole(subProcess->pid);		// disable ctrl-c to not exit this process		SetConsoleCtrlHandler(HandlerRoutine, TRUE);		if (!GenerateConsoleCtrlEvent(CTRL_C_EVENT, subProcess->pid)		    && !GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, subProcess->pid))			TerminateProcess(subProcess->hProcess, 0);		// force exit		if (WaitForSingleObject(subProcess->hProcess, 2000) == WAIT_TIMEOUT)			TerminateProcess(subProcess->hProcess, 0);					// close the console		FreeConsole();		SetConsoleCtrlHandler(HandlerRoutine, FALSE);	}	CheckMounted();}
开发者ID:HirasawaRUS,项目名称:encfs4win,代码行数:33,


示例11: AllocConsole

bool lConsole::Initialize(void *FileHandle, void *Stream, uint32_t ScreenbufferSize){    // Allocate a console if we don't have one.    if (!strstr(GetCommandLineA(), "-nocon"))    {        AllocConsole();        // Take ownership of it.        AttachConsole(GetCurrentProcessId());        // Set the standard streams to use the console.        freopen("CONOUT$", "w", (FILE *)Stream);        // Start the update thread.        if (!UpdateThread.joinable())        {            UpdateThread = std::thread(&lConsole::Int_UpdateThread, this);            UpdateThread.detach();        }    }    // Fill our properties.    ThreadSafe.lock();    this->FileHandle = FileHandle;    this->StreamHandle = Stream;    this->ShouldPrintScrollback = ScreenbufferSize != 0;    this->StartupTimestamp = GetTickCount64();    this->LastTimestamp = this->StartupTimestamp;    this->ScrollbackLineCount = ScreenbufferSize;    this->ScrollbackLines = new lLine[this->ScrollbackLineCount]();    this->ProgressbarCount = 0;    ThreadSafe.unlock();    return true;}
开发者ID:KerriganEN,项目名称:OpenNetPlugin,代码行数:35,


示例12: AllocConsole

void Log::CreateConsole(LPCSTR caption){	AllocConsole();	AttachConsole(GetCurrentProcessId());	freopen("CON", "w", stdout); //-V530	SetConsoleTitleA(caption);}
开发者ID:FaceHunter,项目名称:hAPI,代码行数:7,


示例13: MainThread

bool MainThread(){	AllocConsole();	AttachConsole( GetCurrentProcessId() );	freopen( "CON", "w", stdout );	gCVars.Initialize();	gMenu.Initialize();	printf("[Quake2 Engine Hook By Firehawk]/n");	printf("ModelView: 0x%x, Viewport: 0x%x, Projection: 0x%x/n", &ModelView, &Viewport, &Projection);	while ( !GameAPI )		GameAPI = GameAPI_t::Get();	while (!RenderAPI)		RenderAPI = RenderAPI_t::Get();		//Just to make sure it's hooked in the beginning	hkGetGameAPI(GameAPI);	hkGetRenderAPI(RenderAPI);	g_Memory.ApplyPatches();	printf("Memory patched!/n");	return true;}
开发者ID:xghozt,项目名称:Q2Bot,代码行数:26,


示例14: AllocConsole

		BOOL SysConsole::Open( int x, int y, int w, int h )		{			BOOL r = AllocConsole();			if (!r)				return r;			AttachConsole(GetCurrentProcessId());			MoveWindow(GetConsoleWindow(), x, y, w, h, true);			m_cinbuf = std::cin.rdbuf();			m_console_cin.open("CONIN$");			std::cin.rdbuf(m_console_cin.rdbuf());			m_coutbuf = std::cout.rdbuf();			m_console_cout.open("CONOUT$");			std::cout.rdbuf(m_console_cout.rdbuf());			m_cerrbuf = std::cerr.rdbuf();			m_console_cerr.open("CONOUT$");			std::cerr.rdbuf(m_console_cerr.rdbuf());			FILE *stream;			freopen_s(&stream, "conin$", "r", stdin);			freopen_s(&stream, "conout$", "w", stdout);			freopen_s(&stream, "conout$", "w", stdout);			return r;		}
开发者ID:dotminic,项目名称:code,代码行数:25,


示例15: AllocConsole

void VulkanBase::setupConsole(std::string title) {	AllocConsole();	AttachConsole(GetCurrentProcessId());	freopen("CON", "w", stdout);	SetConsoleTitle(TEXT(title.c_str()));	if (enableValidation)		std::cout << "Validation enabled/n";}
开发者ID:Alexandcoats,项目名称:vulkan-terrain,代码行数:8,


示例16: LogFileInitialize

void LogFileInitialize(const char* strFileName){#ifndef DISABLE_LOG    FILE* f = NULL;    const char* logFilename;    if (strFileName == NULL)    {        SP_strcpy(LogfilePath, SP_MAX_PATH, "c://splog.txt");        logFilename = GetLogFilename();    }    else    {        logFilename = strFileName;        SP_strcpy(LogfilePath, SP_MAX_PATH, strFileName);    }    // It is valid for there to be no Log File. However since this    // is the only place where the log file is initialized, we flag    // it as something to note in the console.    if (logFilename != NULL)    {        // Open for writing - this will overwrite any previous logfile#ifdef _WIN32        fopen_s(&f, logFilename, "w+");    // read binary#else        f = fopen(logFilename, "w+");#endif        if (f != NULL)        {            fprintf(f, "Logging Started: %s/n/n", StringUtils::GetTimeString().c_str());            fclose(f);        }        else        {            Log(logERROR, "Unable to open logfile %s for writing /n", logFilename);        }    }#ifdef WIN32    if (s_ConsoleAttached == false)    {        // ensure the log system is attached to a console        // AttachConsole requires Win 2K or later.        AttachConsole(ATTACH_PARENT_PROCESS);        s_ConsoleAttached = true;    }#endif#else    SP_UNREFERENCED_PARAMETER(strFileName);#endif   //DISABLE_LOG}
开发者ID:PlusChie,项目名称:CodeXL,代码行数:58,


示例17: w__openConsole

int w__openConsole(lua_State *L){	static bool is_open = false;	if (is_open)	{		love::luax_pushboolean(L, is_open);		return 1;	}	is_open = true;	// FIXME: we don't call AttachConsole in Windows XP because it seems to	// break later AllocConsole calls if it fails. A better workaround might be	// possible, but it's hard to find a WinXP system to test on these days...	if (!IsWindowsVistaOrGreater() || !AttachConsole(ATTACH_PARENT_PROCESS))	{		// Create our own console if we can't attach to an existing one.		if (!AllocConsole())		{			is_open = false;			love::luax_pushboolean(L, is_open);			return 1;		}		SetConsoleTitle(TEXT("LOVE Console"));		const int MAX_CONSOLE_LINES = 5000;		CONSOLE_SCREEN_BUFFER_INFO console_info;		// Set size.		GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &console_info);		console_info.dwSize.Y = MAX_CONSOLE_LINES;		SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), console_info.dwSize);	}	FILE *fp;	// Redirect stdout.	fp = freopen("CONOUT$", "w", stdout);	if (L && fp == NULL)		return luaL_error(L, "Console redirection of stdout failed.");	// Redirect stdin.	fp = freopen("CONIN$", "r", stdin);	if (L && fp == NULL)		return luaL_error(L, "Console redirection of stdin failed.");	// Redirect stderr.	fp = freopen("CONOUT$", "w", stderr);	if (L && fp == NULL)		return luaL_error(L, "Console redirection of stderr failed.");	love::luax_pushboolean(L, is_open);	return 1;}
开发者ID:RobLoach,项目名称:love,代码行数:56,


示例18: AllocConsole

void Utils::AllocateConsole(LPCSTR pTitle){	AllocConsole() ;	AttachConsole(GetCurrentProcessId());	freopen("CON", "w", stdout) ;	SetConsoleTitleA(pTitle);	COORD cordinates = {80, 32766};	HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);	SetConsoleScreenBufferSize(handle, cordinates);}
开发者ID:Novo,项目名称:rAPB,代码行数:10,


示例19: GetStdHandle

Console::Console(){	// Attach to the parent console if available, otherwise allocate one	if(!AttachConsole(ATTACH_PARENT_PROCESS)) AllocConsole();	// Get the input/output handles for the attached console	m_stderr = GetStdHandle(STD_ERROR_HANDLE);	m_stdin = GetStdHandle(STD_INPUT_HANDLE);	m_stdout = GetStdHandle(STD_OUTPUT_HANDLE);}
开发者ID:zukisoft,项目名称:vm,代码行数:10,


示例20: AllocConsole

void Debug::Initialize(){	AllocConsole();	AttachConsole(GetCurrentProcessId());	consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);#if _DEBUG	Debug::Log("Debug Initialized");#endif}
开发者ID:ariabonczek,项目名称:NewLumina,代码行数:10,


示例21: setupConsole

void setupConsole(){#ifdef PLATFORM_WINDOWS	// see http://stackoverflow.com/questions/587767/how-to-output-to-console-in-c-windows	// and http://www.libsdl.org/cgi/docwiki.cgi/FAQ_Console	AttachConsole(ATTACH_PARENT_PROCESS);	freopen( "CON", "w", stdout );	freopen( "CON", "w", stderr );#endif}
开发者ID:ACGaming,项目名称:MultiMC5,代码行数:10,


示例22: wWinMain

int APIENTRY wWinMain(_In_ HINSTANCE hInstance,                     _In_opt_ HINSTANCE hPrevInstance,                     _In_ LPWSTR    lpCmdLine,                     _In_ int       nCmdShow){	AttachConsole(ATTACH_PARENT_PROCESS);	// Create a named pipe that we can be signaled on for early termination	wchar_t buf[512];	wsprintf(buf, L"////.//pipe//jobber-%d", GetCurrentProcessId());	HANDLE hPipe = CreateNamedPipe(buf, 		PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED, 		PIPE_READMODE_BYTE | PIPE_WAIT, 		1, 256, 256, 100000, NULL);	OVERLAPPED io = { 0 };	io.hEvent = CreateEvent(NULL, true, true, NULL);	if (!ConnectNamedPipe(hPipe, &io) && GetLastError() != ERROR_IO_PENDING) {		DWORD dwLastError = GetLastError();		return -1;	}	STARTUPINFO si = { 0 };	PROCESS_INFORMATION pi = { 0 };	si.cb = sizeof(STARTUPINFO);	si.wShowWindow = nCmdShow;	if (!CreateProcess(NULL, lpCmdLine, NULL, NULL, true, CREATE_SUSPENDED, NULL, NULL, &si, &pi)) {		DWORD dwLastError = GetLastError();		return -1;	}	HANDLE hJob = CreateJobObject(NULL, NULL);	AssignProcessToJobObject(hJob, pi.hProcess);	ResumeThread(pi.hThread);	HANDLE handles[2];	handles[0] = io.hEvent;	handles[1] = pi.hProcess;	int result = WaitForMultipleObjects(2, handles, false, INFINITE);	TerminateJobObject(hJob, -1);	if (result == WAIT_OBJECT_0) {		return -1;	} else {		DWORD dwExit;		GetExitCodeProcess(pi.hProcess, &dwExit);		return dwExit;	}}
开发者ID:Santei,项目名称:surf,代码行数:55,


示例23: attachOrCreateConsole

void attachOrCreateConsole(){#ifdef _WIN32	static bool consoleAllocated = false;	const bool redirected = (_fileno(stdout) == -2 || _fileno(stdout) == -1); // If output is redirected to e.g a file	if (!consoleAllocated && redirected && (AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole())) {		freopen("CONOUT$", "w", stdout);		freopen("CONOUT$", "w", stderr);		consoleAllocated = true;	}#endif}
开发者ID:HybridDog,项目名称:minetest,代码行数:12,


示例24: GetWordFromConsole

static char* GetWordFromConsole(HWND WND, POINT Pt, int *BeginPos){	TConsoleParams *TP;	DWORD pid;	DWORD WordSize;	char *Result;	*BeginPos=0;	if((TP = malloc(sizeof(TConsoleParams))) == NULL)		return(NULL);	ZeroMemory(TP,sizeof(TConsoleParams));	TP->WND = WND;	TP->Pt = Pt;	ScreenToClient(WND, &(TP->Pt));	GetClientRect(WND, &(TP->ClientRect));//	GetWindowThreadProcessId(GetParent(WND), &pid);	GetWindowThreadProcessId(WND, &pid);	if (pid != GetCurrentProcessId()) {	        if(Is_XP_And_Later()) {			if(AttachConsole(pid)) {				WordSize = GetWordFromConsolePack(TP);				FreeConsole();			} else {				WordSize = 0;			}		} else {			WordSize = 0;		}	} else {		WordSize = GetWordFromConsolePack(TP);	}	if (WordSize > 0 && WordSize <= 255) {		TEverythingParams CParams;		ZeroMemory(&CParams, sizeof(CParams));		CParams.Unicode=1;		CParams.BeginPos=TP->BeginPos;		CParams.WordLen=WordSize;		CopyMemory(CParams.MatchedWordW, TP->Buffer, WordSize * sizeof(wchar_t));		ConvertToMatchedWordA(&CParams);		*BeginPos = CParams.BeginPos;		Result = _strdup(CParams.MatchedWordA);	} else {		Result = NULL;	}	free(TP);	return Result;}
开发者ID:MCHALAO,项目名称:goldendict,代码行数:52,


示例25: debugf

void CServiceModule::BreakChildren(){	debugf("intentionally stopping any games.../n");	for (int i = 0; i < 98; i++) {		DWORD pid = this->m_dwPIDs[i];		if (pid) {			FreeConsole();			AttachConsole(pid);			GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, pid);			debugf("bye bye %d.../n", pid);		}	}}
开发者ID:AllegianceZone,项目名称:Allegiance,代码行数:13,


示例26: AllocConsole

void NsConsole::Show(){	AllocConsole();	AttachConsole(GetCurrentProcessId());	freopen("CON", "w", stdout);	SetConsoleTitle(L"There Is No Spoon Console");	_bShowing = true;	for(int i = 0; i < _messages.Size(); ++i)	{		printf("%s/n", _messages[i].c_str());	}}
开发者ID:Bastila,项目名称:c-plus-plus-examples,代码行数:13,


示例27: main

int main(int argc, const char* argv[]){	InitCommonControls();	if (AttachConsole(ATTACH_PARENT_PROCESS))	{		freopen("CONOUT$", "wb", stdout);		freopen("CONOUT$", "wb", stderr);	}	uifiber = ConvertThreadToFiber(NULL);	assert(uifiber);	appfiber = CreateFiber(0, application_cb, NULL);	assert(appfiber);	realargc = argc;	realargv = argv;	/* Run the application fiber. This will deschedule when it wants an	 * event.	 */	SwitchToFiber(appfiber);	/* And now the event loop. */	int oldtimeout = -1;	for (;;)	{		MSG msg;		dpy_flushkeys();		if (timeout != oldtimeout)		{			if (timeout == -1)				KillTimer(window, TIMEOUT_TIMER_ID);			else				SetTimer(window, TIMEOUT_TIMER_ID, timeout*1000, NULL);			oldtimeout = timeout;		}		GetMessageW(&msg, NULL, 0, 0);		if (DispatchMessageW(&msg) == 0)			TranslateMessage(&msg);	}	return 0;}
开发者ID:NRauh,项目名称:wordgrinder,代码行数:51,


示例28: frontend_win32_attach_console

static void frontend_win32_attach_console(void){#ifdef _WIN32   if (!AttachConsole(ATTACH_PARENT_PROCESS))   {      AllocConsole();      AttachConsole( GetCurrentProcessId()) ;   }   freopen( "CON", "w", stdout );   freopen( "CON", "w", stderr );#endif}
开发者ID:Ezio-PS,项目名称:RetroArch,代码行数:12,


示例29: consoleOpen

	void consoleOpen()	{		//Check if application does not have a console already open		if (GetStdHandle(STD_OUTPUT_HANDLE) == NULL)		{			AllocConsole();			if (int code = AttachConsole(GetCurrentProcessId()))			{				tserror("AttachConsole failed with code %", code);			}			FILE* fp = nullptr;			errno_t e = 0;			tsassert(!(e = freopen_s(&fp, "CONOUT$", "w", stdout)));			tsassert(!(e = freopen_s(&fp, "CONIN$", "r", stdin)));			//tsassert(!(e = freopen_s(&fp, "CONERR$", "w", stderr))); //todo: fix opening of stderr			//Synchronise with standard library console functions/objects (cout/cin/cerr)			std::ios::sync_with_stdio();		}		ts::global::getLogger().addStream(&getConsoleStreamInstance());	}
开发者ID:BrotherhoodOfHam,项目名称:Engine3D,代码行数:26,



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


C++ AttachThreadInput函数代码示例
C++ AttachChild函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。