Esempio n. 1
1
void DevConsoleCreate(){

	CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
	int consoleHandleR, consoleHandleW;
	long stdioHandle;
	FILE *fptr;

	AllocConsole();
	std::wstring strW = L"Dev Console";
	SetConsoleTitle(strW.c_str());

	EnableMenuItem(GetSystemMenu(GetConsoleWindow(), FALSE), SC_CLOSE, MF_GRAYED);
	DrawMenuBar(GetConsoleWindow());

	GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &consoleInfo);
	
	freopen("conin$", "r", stdin);
	freopen("conout$", "w", stdout);
	freopen("conout$", "w", stderr);


}
Esempio n. 2
0
/*--------------------------------------------------------------------
The delegate object calls this method during initialization of an 
ARDrone application 
--------------------------------------------------------------------*/
C_RESULT ardrone_tool_init_custom(int argc, char **argv)
{
	/* Change the console title */
		vp_os_mutex_init(&consoleMutex);
		system("cls");
		SetConsoleTitle(TEXT("Parrot A.R. Drone SDK Demo for Windows"));
		//CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)&HmiStart,NULL,0,0);
		//CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)&HmiStart2,NULL,0,0);


	/* Registering for a new device of game controller */
		ardrone_tool_input_add( &dx_keyboard );
		ardrone_tool_input_add( &dx_gamepad );
	
	/* Start all threads of your application */
		START_THREAD( directx_renderer_thread , NULL);
		START_THREAD( video_stage, NULL );

		
  
  return C_OK;
}
Esempio n. 3
0
xlwLogger::xlwLogger(){
    theConsoleHandel= GetConsoleWindow();
    if(theConsoleHandel)FreeConsole();

    BOOL flag = AllocConsole();
    theConsoleHandel= GetConsoleWindow();
    theScreenHandel = GetStdHandle(STD_OUTPUT_HANDLE);
    wchar_t titlePtr[]=L" xlwLogger Window \0";
    
    SetConsoleTitle(LPCWSTR(titlePtr));

    time(&theTime[0]);
    theInnerStream << " xlwLogger Initiated    " 
                   << ctime(&theTime[0])
                   << " \n Code Compiled " 
                   << __TIME__  << "  "
                   << __DATE__;
    Display();
    
    theTimeIndex=0;
    
}
Esempio n. 4
0
int wmain(int argc, wchar_t * argv[])
{
	int i, status = STATUS_SUCCESS;
#ifndef _WINDLL
	wchar_t input[0xff];
	_setmode(_fileno(stdout), _O_U8TEXT);
	_setmode(_fileno(stderr), _O_U8TEXT);
	SetConsoleOutputCP(CP_UTF8);
	SetConsoleTitle(MIMIKATZ L" " MIMIKATZ_VERSION L" " MIMIKATZ_ARCH);
	SetConsoleCtrlHandler(HandlerRoutine, TRUE);
#endif
	kprintf(L"\n"
		L"  .#####.   " MIMIKATZ_FULL L"\n"
		L" .## ^ ##.  \n"
		L" ## / \\ ##  /* * *\n"
		L" ## \\ / ##   Benjamin DELPY `gentilkiwi` ( [email protected] )\n"
		L" '## v ##'   http://blog.gentilkiwi.com/mimikatz             (oe.eo)\n"
		L"  '#####'                                    with %3u modules * * */\n\n", sizeof(mimikatz_modules) / sizeof(KUHL_M *));
	
	mimikatz_initOrClean(TRUE);
	for(i = MIMIKATZ_AUTO_COMMAND_START ; (i < argc) && (status != STATUS_FATAL_APP_EXIT) ; i++)
	{
		kprintf(L"\n" MIMIKATZ L"(" MIMIKATZ_AUTO_COMMAND_STRING L") # %s\n", argv[i]);
		status = mimikatz_dispatchCommand(argv[i]);
	}
#ifndef _WINDLL
	while (status != STATUS_FATAL_APP_EXIT)
	{
		kprintf(L"\n" MIMIKATZ L" # "); fflush(stdin);
		if(wscanf_s(L"%[^\n]s", input, sizeof(input)) == 1)
		{
			kprintf_inputline(L"%s\n", input);
			status = mimikatz_dispatchCommand(input);
		}
	}
#endif
	mimikatz_initOrClean(FALSE);
	return STATUS_SUCCESS;
}
Esempio n. 5
0
int main()
{
	SetConsoleTitle("Login server for Knight Online v" STRINGIFY(__VERSION));

	// Override the console handle
	SetConsoleCtrlHandler(_ConsoleHandler, TRUE);

	// Startup server
	if (!g_pMain.Startup())
	{
		system("pause"); // most users won't be running this via command prompt
		return 1;
	}

	printf("\nServer started up successfully!\n");

	// Create handle, wait until console's signaled as closing
	s_hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
	WaitForSingleObject(s_hEvent, INFINITE);

	return 0;
}
Esempio n. 6
0
int main()
{
  CXBOXController controller(1);
  Gopher gopher(&controller);
  HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  SetConsoleTitle( TEXT( "Gopher360" ) );

  system("Color 1D");

  printf("Welcome to Gopher360 - a VERY fast and lightweight controller-to-keyboard & mouse input tool.\n");
  printf("All you need is an Xbox360/Xbone controller (wired or wireless adapter), or DualShock (with InputMapper 1.5+)\n");
  printf("Gopher will autofind the xinput device and begin reading input - if nothing happens, verify connectivity.\n");
  printf("See the GitHub repository at bit.ly/1syAhMT for more info. Twitter contact: TylerAt60FPS\n\n-------------------------\n\n");
  
  SetConsoleTextAttribute(hConsole, 23);
  printf("Gopher is free (as in freedom) software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n");
  printf("\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.");
  SetConsoleTextAttribute(hConsole, 29);
  printf("\n\n-------------------------\n\n");

  SetConsoleTextAttribute(hConsole, 5); // set color to purple on black (windows only)
  // 29 default

  // dump important tips
  printf("Tip - Press left and right bumpers simultaneously to toggle speeds! (Default is left and right bumpers, configurable in config.ini)\n");

  if (!isRunningAsAdministrator())
  {
    printf("Tip - Not running as an admin! Windows on-screen keyboard and others won't work without admin rights.\n");
  }

  gopher.loadConfigFile();

  // Start the Gopher program loop
  while (true)
  {
    gopher.loop();
  }
}
Esempio n. 7
0
// =================================================================================
// Init
// Called right after the CTor
// =================================================================================
void GTALua::Init()
{
	// Main Config
	LoadGTALuaIni();

	// Attach Console
#ifndef GTA_LUA_TEST_EXE
	if (m_sConfig.bConsole_Enabled)
	{
		UTIL::Attach_Console(m_sConfig.bConsole_AutomaticPosition, m_sConfig.iConsole_ManualX, m_sConfig.iConsole_ManualY);
		SetConsoleTitle("GTALua - Version 1.1.2");
	}
#endif

	// Prepare Memory
	Memory::Init();
	GameMemory::Init();

	// Configuration Files
	LoadNativesINI();
	LoadCallLayoutsINI();
}
Esempio n. 8
0
/*
==================
CON_Init
==================
 */
void CON_Init(void) {
    CONSOLE_CURSOR_INFO curs;
    CONSOLE_SCREEN_BUFFER_INFO info;
    int i;

    // handle Ctrl-C or other console termination
    SetConsoleCtrlHandler(CON_CtrlHandler, TRUE);

    qconsole_hin = GetStdHandle(STD_INPUT_HANDLE);
    if (qconsole_hin == INVALID_HANDLE_VALUE)
        return;

    qconsole_hout = GetStdHandle(STD_OUTPUT_HANDLE);
    if (qconsole_hout == INVALID_HANDLE_VALUE)
        return;

    GetConsoleMode(qconsole_hin, &qconsole_orig_mode);

    // allow mouse wheel scrolling
    SetConsoleMode(qconsole_hin,
            qconsole_orig_mode & ~ENABLE_MOUSE_INPUT);

    FlushConsoleInputBuffer(qconsole_hin);

    GetConsoleScreenBufferInfo(qconsole_hout, &info);
    qconsole_attrib = info.wAttributes;

    SetConsoleTitle("ioquake3 Dedicated Server Console");

    // make cursor invisible
    GetConsoleCursorInfo(qconsole_hout, &qconsole_orig_cursorinfo);
    curs.dwSize = 1;
    curs.bVisible = FALSE;
    SetConsoleCursorInfo(qconsole_hout, &curs);

    // initialize history
    for (i = 0; i < QCONSOLE_HISTORY; i++)
        qconsole_history[ i ][ 0 ] = '\0';
}
Esempio n. 9
0
void Apep::initialize(std::string name, int width_ = 80, int height_ = 60) {
    tin  = GetStdHandle(STD_INPUT_HANDLE);
    tout = GetStdHandle(STD_OUTPUT_HANDLE);
    
    SetConsoleTitle(name.c_str());
        
    { // hide console cursor
        CONSOLE_CURSOR_INFO cci;
        GetConsoleCursorInfo(tout, &cci);
        cci.bVisible = false;
        cci.dwSize   = 1;
        SetConsoleCursorInfo(tout, &cci);
    }

    width  = width_;
    height = height_;
    
    assert("width must be > 1!" && width > 1);
    assert("height must be > 1!" && height > 1);
    // resizing console window
    {
        SMALL_RECT cs = { 0, 0, width - 1, height - 1 };
        consoleSize = cs;
        COORD bs      = { width, height };
        buffSize = bs;
        SetConsoleWindowInfo(tout, TRUE, &consoleSize);
        SetConsoleScreenBufferSize(tout, buffSize);
    }

    { // turning off showing keys being pressed
        DWORD mode;
        GetConsoleMode(tin, &mode);
        SetConsoleMode(tin, mode & ~ENABLE_ECHO_INPUT);
    }

    // allocating back buffer
    total_size  = width * height;
    back_buffer = new CHAR_INFO[total_size];
}
Esempio n. 10
0
VOID CConsole::Init()
{
	m_uiIndent = 0;
	m_hOutput = NULL;

	// create the console
	if ( !AllocConsole() )
	{
		throw BLUELY_EXCEPTION("CConsole::Create", "AllocConsole failed");
	}
	
	// get the handle to std out
	m_hOutput = GetStdHandle(STD_OUTPUT_HANDLE);

	if ( INVALID_HANDLE_VALUE == m_hOutput )
	{
		throw BLUELY_EXCEPTION( "CConsole::Create()", "GetStdHandle() - Output handle - failed" );
	}

	// console title
	SetConsoleTitle("Bluely Logging Console(BLC) - Ver(0.1)");
}
Esempio n. 11
0
void SDLAppCreateWindowsConsole() {
    if(using_parent_console || gSDLAppConsoleWindow != 0) return;

    //try to attach to the available console if there is one

    if(SDLAppAttachToConsole()) return;

    //create a console on Windows so users can see messages
    //find an available name for our window

    char consoleTitle[512];
    int console_suffix = 0;
    sprintf(consoleTitle, "%s Console", gSDLAppTitle.c_str());

    while(FindWindow(0, consoleTitle)) {
        sprintf(consoleTitle, "%s Console %d", gSDLAppTitle.c_str(), ++console_suffix);
    }

    AllocConsole();
    SetConsoleTitle(consoleTitle);

    //redirect streams to console
    freopen("conin$", "r", stdin);
    freopen("conout$","w", stdout);
    freopen("conout$","w", stderr);

    gSDLAppConsoleWindow = 0;

    //wait for our console window
    while(gSDLAppConsoleWindow==0) {
        gSDLAppConsoleWindow = FindWindow(0, consoleTitle);
        SDL_Delay(100);
    }

    //disable the close button so the user cant crash the application
    HMENU hm = GetSystemMenu(gSDLAppConsoleWindow, false);
    DeleteMenu(hm, SC_CLOSE, MF_BYCOMMAND);
}
Esempio n. 12
0
REProgress::REProgress(const TCHAR* aszTitle, BOOL abGraphic /*= FALSE*/, const TCHAR* aszFileInfo /*= NULL*/)
	: CScreenRestore(NULL, aszTitle)
{
	_ASSERTE(gpProgress == NULL);
	bEscaped = FALSE;
	bGraphic = abGraphic;
	nAllCount = nCurrent = 0;
	psPercentTitle = psLastTitle = NULL;
	#ifdef _UNICODE
	cFull = 0x2588; cHollow = 0x2591;
	#else
	cFull = '\xB0'; cHollow = '\xDB';
	#endif
	nProgressLen = countof(sProgress)-1;
	if (bGraphic)
	{
		for (int i = 0; i < nProgressLen; i++)
			sProgress[i] = cHollow;
		sProgress[nProgressLen] = 0;
		pszFormat = NULL;
		psLastTitle = (TCHAR*)malloc(2048*sizeof(TCHAR));
		if (!GetConsoleTitle(psLastTitle, 2048)) {
			SafeFree(psLastTitle);
		} else if (aszTitle) {
			int nLen = lstrlen(aszTitle);
			psPercentTitle = (TCHAR*)malloc((nLen+64)*sizeof(TCHAR));
			wsprintf(psPercentTitle, _T("{  0%%} %s"), aszTitle);
			SetConsoleTitle(psPercentTitle);
		}
	} else {
		pszFormat = GetMsg(REExportItemsProgress);
		wsprintf(sProgress, pszFormat, 0, 1);
	}
	nStepDuration = 1000; nCounter = 0; sFileInfo[0] = 0;
	if (aszFileInfo) lstrcpyn(sFileInfo, aszFileInfo, countof(sFileInfo));
	nStartTick = GetTickCount();
	Update(/*(aszFileInfo && aszFileInfo[0]) ? aszFileInfo : NULL*/);
}
Esempio n. 13
0
int main( int argc, char **argv )
{
#ifdef _WIN32
    SetConsoleTitle( "Cynosure" );
#else
    struct termios termattr;
    tcgetattr(0, &termattr);
    termattr.c_lflag &= ~(ICANON | ECHO);
    tcsetattr(0, TCSANOW, &termattr);
#endif

    vm_state *state = new vm_state( "floppy_1_44.img", "debug.log", 1024 * 1024 );
    state->CR0.protectedMode    = false;
    state->CR0.emulation        = true;

    EFLAGS.direction = false;

    opcode opcodes[256];
    opcodesGenerate( opcodes );
    
    state->running = true;
    while (state->running)
    {
        opcode currOpcode = opcodes[ CURR_INS ];

        LOG_STREAM << "0x" << std::setw(2) << std::hex << (uint32_t)currOpcode.opc << ": " << currOpcode.name.c_str();

        currOpcode.func( state, currOpcode );
        EIP.r += currOpcode.GetFinalOffset( state );
        
        LOG_STREAM << std::endl;

        //state->LogRegisters( );
    }
    
    delete state;
    return 0;
} 
/** 
 * Main entrypoint, guarded by a try ... except.
 * This expects 4 parameters:
 *		The image path and name
 *		The working directory path, which has to be unique to the instigating process and thread.
 *		The parent process Id
 *		The thread Id corresponding to this worker
 */
int32 GuardedMain(int32 argc, TCHAR* argv[])
{
	GEngineLoop.PreInit(argc, argv, TEXT("-NOPACKAGECACHE -Multiprocess"));
#if DEBUG_USING_CONSOLE
	GLogConsole->Show( true );
#endif

#if PLATFORM_WINDOWS
	//@todo - would be nice to change application name or description to have the ThreadId in it for debugging purposes
	SetConsoleTitle(argv[3]);
#endif

	// We just enumerate the shader formats here for debugging.
	const TArray<const class IShaderFormat*>& ShaderFormats = GetShaderFormats();
	check(ShaderFormats.Num());
	TMap<FString, uint16> FormatVersionMap;
	for (int32 Index = 0; Index < ShaderFormats.Num(); Index++)
	{
		TArray<FName> OutFormats;
		ShaderFormats[Index]->GetSupportedFormats(OutFormats);
		check(OutFormats.Num());
		for (int32 InnerIndex = 0; InnerIndex < OutFormats.Num(); InnerIndex++)
		{
			UE_LOG(LogShaders, Display, TEXT("Available Shader Format %s"), *OutFormats[InnerIndex].ToString());
			uint16 Version = ShaderFormats[Index]->GetVersion(OutFormats[InnerIndex]);
			FormatVersionMap.Add(OutFormats[InnerIndex].ToString(), Version);
		}
	}

	LastCompileTime = FPlatformTime::Seconds();

	FWorkLoop::ECommunicationMode Mode = FWorkLoop::ThroughFile;
	FWorkLoop WorkLoop(argv[2], argv[1], argv[4], argv[5], Mode, FormatVersionMap);

	WorkLoop.Loop();

	return 0;
}
Esempio n. 15
0
NF_EXPORT void DllStartPlugin(NFIPluginManager* pm)
{
#if NF_PLATFORM == NF_PLATFORM_WIN
    SetConsoleTitle("Tutorial6");
#endif
    CREATE_PLUGIN(pm, Tutorial6Plugin)

};

NF_EXPORT void DllStopPlugin(NFIPluginManager* pm)
{
    DESTROY_PLUGIN(pm, Tutorial6Plugin)
};

#endif
//////////////////////////////////////////////////////////////////////////

const int Tutorial6Plugin::GetPluginVersion()
{
    return 0;
}

const std::string Tutorial6Plugin::GetPluginName()
{
    GET_PLUGIN_NAME(Tutorial6Plugin)
}

void Tutorial6Plugin::Install()
{

    REGISTER_MODULE(pPluginManager, HelloWorld6Module)

}

void Tutorial6Plugin::Uninstall()
{
    UNREGISTER_MODULE(pPluginManager, HelloWorld6Module)
}
Esempio n. 16
0
main()
{
	//设置console窗口的标题
	SetConsoleTitle("copying...");
	printf("\n");

	int i = 0;
	printf("files copied %3d%%...\n", i);

	COORD origin = {13, 1};	//只有在声明时可以这样赋值
	HANDLE hConsoleOut;
	DWORD charWritten;
	char buf[16];

	//得到console的句柄
	hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE);

	while(i < 100)
	{
		i++;
		//转换成10进制的数的字符串,存到buf中。
		_itoa(i, buf, 10);	

		//在指定的位置输出字符串,charWritten表示输出的字符数
		WriteConsoleOutputCharacter( hConsoleOut, buf, 3, origin, &charWritten);
		Sleep(200);

	}

	strcpy( buf, "completed. \n");
	WriteConsoleOutputCharacter( hConsoleOut, buf, strlen(buf) + 1 , origin, &charWritten);

	//关闭标准输出的句柄。
	//CloseHandle减少object的引用计数
	//当引用计数为0时,系统会清除该对象
	CloseHandle( hConsoleOut);

}
Esempio n. 17
0
NF_EXPORT void DllStartPlugin(NFIPluginManager* pm)
{
#if NF_PLATFORM == NF_PLATFORM_WIN
	SetConsoleTitle("NFLoginServer");
#endif
    CREATE_PLUGIN(pm, NFLoginLogicPlugin)

};

NF_EXPORT void DllStopPlugin(NFIPluginManager* pm)
{
    DESTROY_PLUGIN(pm, NFLoginLogicPlugin)
};

#endif
//////////////////////////////////////////////////////////////////////////

const int NFLoginLogicPlugin::GetPluginVersion()
{
    return 0;
}

const std::string NFLoginLogicPlugin::GetPluginName()
{
    GET_PLUGIN_NAME(NFLoginLogicPlugin)
}

void NFLoginLogicPlugin::Install()
{

    REGISTER_MODULE(pPluginManager, NFCLoginLogicModule)

}

void NFLoginLogicPlugin::Uninstall()
{
    UNREGISTER_MODULE(pPluginManager, NFCLoginLogicModule)
}
Esempio n. 18
0
int win32_main(int argc, char *argv[])
{
	DWORD error_code;
	gchar* error_message;

	service_argc = argc;
	service_argv = argv;

	if (StartServiceCtrlDispatcher(service_registry))
		return 0; /* run as service successefully */

	error_code = GetLastError();
	if (error_code == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT) {
		/* running as console app */
		SetConsoleTitle("Music Player Daemon");
		ignore_console_events = TRUE;
		SetConsoleCtrlHandler(console_handler, TRUE);
		return mpd_main(argc, argv);
	}

	error_message = g_win32_error_message(error_code);
	MPD_ERROR("StartServiceCtrlDispatcher() failed: %s", error_message);
}
Esempio n. 19
0
bool IOConsole::CreateConsole(HWND hWnd)
{
	m_hWnd = hWnd;
#ifdef _DEBUG
	// Try to create a console
	if (AllocConsole() == NULL)
	{
		MessageBox(0, L"CANNOT ALLOCATE CONSOLE!", L"ERROR", MB_OK | MB_ICONSTOP);
		return false;
	}
	FILE* pStream;
	freopen_s(&pStream, "CON", "w", stdout);
	freopen_s(&pStream, "CON", "w", stderr);
	freopen_s(&pStream, "CON", "r", stdin);
	SetConsoleTitle(L"NDGameEngine Debug Console");
	HWND hwnd = GetConsoleWindow();
	HMENU hmenu = GetSystemMenu(hwnd, FALSE);
	EnableMenuItem(hmenu, SC_CLOSE, MF_GRAYED);
#endif
	SetForegroundWindow(hWnd);
	m_hOutput = CreateFile(L"CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
	return true;
}
Esempio n. 20
0
void OSystem_Win32::initBackend() {
	// Console window is enabled by default on Windows
	ConfMan.registerDefault("console", true);

	// Enable or disable the window console window
	if (ConfMan.getBool("console")) {
		if (AllocConsole()) {
			freopen("CONIN$","r",stdin);
			freopen("CONOUT$","w",stdout);
			freopen("CONOUT$","w",stderr);
		}
		SetConsoleTitle("ResidualVM Status Window");
	} else {
		FreeConsole();
	}

	// Create the savefile manager
	if (_savefileManager == 0)
		_savefileManager = new WindowsSaveFileManager();

	// Invoke parent implementation of this method
	OSystem_SDL::initBackend();
}
Esempio n. 21
0
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) {
    // create the console
    if(AllocConsole()) {
        freopen("CONOUT$", "w", stdout);
        SetConsoleTitle("Debug Console");
        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED);  
    }

    // set std::cout to use my custom streambuf
    outbuf ob;
    std::streambuf *sb = std::cout.rdbuf(&ob);

    // do some work here
    std::clog << "hmm\n";
	OutputDebugString("Asdf");

    // make sure to restore the original so we don't get a crash on close!
    std::cout.rdbuf(sb);
	ShellExecute(NULL,"open","http://localhost:889",NULL,NULL,SW_SHOWNORMAL);
	OutputDebugString("finished");
    return 0;

}
Esempio n. 22
0
int setTitle(std::string titleMsg)
{
	std::string title = "[RFO Emulator] ";
#ifdef _WIN32
#include <windows.h>
#ifdef _UNICODE
	LPCWSTR str;
#else
	LPCSTR str;
#endif
	title.append(titleMsg);	
	const char* cs = title.c_str();
	wchar_t filename[4096] = { 0 };
	MultiByteToWideChar(0, 0, cs, (int)strlen(cs), filename, (int)strlen(cs));
	return SetConsoleTitle(str = filename);
#else
	char esc_start[] = { 0x1b, ']', '0', ';', 0 };
	char esc_end[] = { 0x07, 0 };
	std::cout << esc_start << title << titleMsg << esc_end;
	return 1;
#endif
	return 0;
}
Esempio n. 23
0
File: help.c Progetto: 0xheart0/vlc
/*****************************************************************************
 * ShowConsole: On Win32, create an output console for debug messages
 *****************************************************************************
 * This function is useful only on Win32.
 *****************************************************************************/
static void ShowConsole( void )
{
    if( getenv( "PWD" ) ) return; /* Cygwin shell or Wine */

    if( !AllocConsole() ) return;

    /* Use the ANSI code page (e.g. Windows-1252) as expected by the LibVLC
     * Unicode/locale subsystem. By default, we have the obsolecent OEM code
     * page (e.g. CP437 or CP850). */
    SetConsoleOutputCP (GetACP ());
    SetConsoleTitle (TEXT("VLC media player version ") TEXT(PACKAGE_VERSION));

    freopen( "CONOUT$", "w", stderr );
    freopen( "CONIN$", "r", stdin );

    if( freopen( "vlc-help.txt", "wt", stdout ) != NULL )
    {
        fputs( "\xEF\xBB\xBF", stdout );
        fprintf( stderr, _("\nDumped content to vlc-help.txt file.\n") );
    }
    else
        freopen( "CONOUT$", "w", stdout );
}
Esempio n. 24
0
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;
}
Esempio n. 25
0
// 100, 100, "Dolphin Log Console"
// Open console window - width and height is the size of console window
// Name is the window title
void ConsoleListener::Open(bool Hidden, int Width, int Height, const char *Title)
{
#ifdef _WIN32
	if (!GetConsoleWindow())
	{
		// Open the console window and create the window handle for GetStdHandle()
		AllocConsole();
		// Hide
		if (Hidden) ShowWindow(GetConsoleWindow(), SW_HIDE);
		// Save the window handle that AllocConsole() created
		hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
		// Set the console window title
		SetConsoleTitle(UTF8ToTStr(Title).c_str());
		// Set letter space
		LetterSpace(80, 4000);
		//MoveWindow(GetConsoleWindow(), 200,200, 800,800, true);
	}
	else
	{
		hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
	}
#endif
}
Esempio n. 26
0
void CConsole::initconsole()
{
  conin =  GetStdHandle(STD_INPUT_HANDLE);
  conout = GetStdHandle(STD_OUTPUT_HANDLE);

  ZeroMemory(&ovc,sizeof(ovc));
  ovc.hEvent = CreateEvent(NULL,FALSE,FALSE,NULL);
  if(ovc.hEvent == INVALID_HANDLE_VALUE) {
     throw errors("CreateEvent error");
  }

  SetConsoleMode(conin,ENABLE_MOUSE_INPUT);
  GetConsoleScreenBufferInfo(conout,&csb);
  if (csb.dwSize.X<80||csb.dwSize.Y<25){
     CloseHandle(ovc.hEvent);
     throw errors("console size is too small");
  }
  FlushConsoleInputBuffer(conin);
  head=tail=0;
  cci.bVisible=0;cci.dwSize=10;
  SetConsoleCursorInfo(conout,&cci);
  SetConsoleTitle(jmail);
}
Esempio n. 27
0
/*
==================
CON_Init
==================
*/
void CON_Init( void )
{
	CONSOLE_SCREEN_BUFFER_INFO info;
	int i;

	// handle Ctrl-C or other console termination
	SetConsoleCtrlHandler( CON_CtrlHandler, TRUE );

	qconsole_hin = GetStdHandle( STD_INPUT_HANDLE );
	if( qconsole_hin == INVALID_HANDLE_VALUE )
		return;

	qconsole_hout = GetStdHandle( STD_OUTPUT_HANDLE );
	if( qconsole_hout == INVALID_HANDLE_VALUE )
		return;

	GetConsoleMode( qconsole_hin, &qconsole_orig_mode );

	// allow mouse wheel scrolling
	SetConsoleMode( qconsole_hin,
		qconsole_orig_mode & ~ENABLE_MOUSE_INPUT );

	FlushConsoleInputBuffer( qconsole_hin ); 

	GetConsoleScreenBufferInfo( qconsole_hout, &info );
	qconsole_attrib = info.wAttributes;
	qconsole_backgroundAttrib = qconsole_attrib & (BACKGROUND_BLUE|BACKGROUND_GREEN|BACKGROUND_RED|BACKGROUND_INTENSITY);

	SetConsoleTitle(CLIENT_WINDOW_TITLE " Dedicated Server Console");

	// initialize history
	for( i = 0; i < QCONSOLE_HISTORY; i++ )
		qconsole_history[ i ][ 0 ] = '\0';

	// set text color to white
	SetConsoleTextAttribute( qconsole_hout, CON_ColorCharToAttrib( COLOR_WHITE ) );
}
Esempio n. 28
0
BOOL CLog::StartLog(std::string strPrefix, std::string strLogDir)
{
#ifdef WIN32
	SetConsoleTitle(strPrefix.c_str());
#endif

	std::string strPath = CommonFunc::GetCurrentDir();

	strPath += ("/Log");

	if(!CommonFunc::CreateDir(strPath))
	{
		return FALSE;
	}

	m_pLogFile = NULL;

	time_t _time;
	time(&_time);

	tm *pTime = localtime(&_time);

	CHAR szFileName[256];

	sprintf(szFileName,"%s/%s-%02d%02d%02d-%02d%02d%02d.log",  strPath.c_str(),strPrefix.c_str(), pTime->tm_year, pTime->tm_mon, pTime->tm_mday, pTime->tm_hour, pTime->tm_min, pTime->tm_sec);

	m_pLogFile = fopen(szFileName, "w+");

	if(m_pLogFile == NULL)
	{
		return FALSE;
	}

	m_LogCount = 0;

	return TRUE;
}
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPTSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

 	// TODO: Place code here.
	MSG msg;
	HACCEL hAccelTable;

	// Initialize global strings
	LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
	LoadString(hInstance, IDC_WIN32EVENTSAMPLE, szWindowClass, MAX_LOADSTRING);
	MyRegisterClass(hInstance);

	// Perform application initialization:
	if (!InitInstance (hInstance, nCmdShow))
	{
		return FALSE;
	}

	hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WIN32EVENTSAMPLE));

    AllocConsole();
    SetConsoleTitle(szTitle);

	// Main message loop:
	while (GetMessage(&msg, NULL, 0, 0))
	{
    	TranslateMessage(&msg);
	    DispatchMessage(&msg);
	}

	return (int) msg.wParam;
}
Esempio n. 30
0
/*VARARGS*/
void
SetXtermTitle(const char *const fmt, ...)
{
	va_list ap;
	char buf[256];

	if ((gXtermTitle != 0) && (gMaySetXtermTitle != 0)) {
		if ((fmt == NULL) || (ISTRCMP(fmt, "RESTORE") == 0)) {
#if (defined(WIN32) || defined(_WINDOWS)) && defined(_CONSOLE)
			STRNCPY(buf, gSavedConsoleTitle);
#else
			STRNCPY(buf, gTerm);
#endif
		} else if (ISTRCMP(fmt, "DEFAULT") == 0) {
			(void) Strncpy(buf, gVersion + 5, 12);
		} else {
			va_start(ap, fmt);
#ifdef HAVE_VSNPRINTF
			(void) vsnprintf(buf, sizeof(buf) - 1, fmt, ap);
			buf[sizeof(buf) - 1] = '\0';
#else
			(void) vsprintf(buf, fmt, ap);
#endif
			va_end(ap);
		}
		if (buf[0] != '\0') {
#if (defined(WIN32) || defined(_WINDOWS)) && defined(_CONSOLE)
			SetConsoleTitle(buf);
#else
			if (strcmp(gCurXtermTitleStr, buf) != 0) {
				fprintf(stderr, "\033]0;%s\007", buf);
				STRNCPY(gCurXtermTitleStr, buf);
			}
#endif
		}
	}
}	/* SetXtermTitle */