示例#1
0
void CMainMenu::ResetMenu(void) 
{
	WriteTrace(TraceDebug,__FUNCTION__ ": Start");
	if (!g_Settings->LoadBool(UserInterface_InFullScreen))
	{
		//Create a new window with all the items
		WriteTrace(TraceDebug,__FUNCTION__ ": Create Menu");
		HMENU hMenu = (HMENU)CreateMenu();
		FillOutMenu(hMenu);
		WriteTrace(TraceDebug,__FUNCTION__ ": Create Menu Done");

		//save old menu to destroy latter
		HMENU OldMenuHandle;
		{
			CGuard Guard(m_CS);
			OldMenuHandle = m_MenuHandle;

			//save handle and re-attach to a window
			WriteTrace(TraceDebug,__FUNCTION__ ": Attach Menu");
			m_MenuHandle = hMenu;
		}
		_Gui->SetWindowMenu(this);

		WriteTrace(TraceDebug,__FUNCTION__ ": Remove plugin menu");
		if (g_Plugins->Gfx() != NULL && IsMenu((HMENU)g_Plugins->Gfx()->GetDebugMenu()))
		{
			RemoveMenu((HMENU)OldMenuHandle,(DWORD)g_Plugins->Gfx()->GetDebugMenu(), MF_BYCOMMAND); 
		}
		if (g_Plugins->RSP() != NULL && IsMenu((HMENU)g_Plugins->RSP()->GetDebugMenu()))
		{
			RemoveMenu((HMENU)OldMenuHandle,(DWORD)g_Plugins->RSP()->GetDebugMenu(), MF_BYCOMMAND); 
		}
		WriteTrace(TraceDebug,__FUNCTION__ ": Destroy Old Menu");

		//Destroy the old menu
		DestroyMenu((HMENU)OldMenuHandle); 
	}

	ResetAccelerators();

	WriteTrace(TraceDebug,__FUNCTION__ ": Done");
}
void
JXMenuBar::DeleteMenu
	(
	const JIndex index
	)
{
	JXMenu* theMenu = RemoveMenu(index);
	assert( theMenu->itsOwner == NULL );
	theMenu->itsMenuBar = NULL;
	delete theMenu;
}
示例#3
0
void DestroyGCMenu(HMENU *hMenu, int iIndex)
{
	MENUITEMINFO mii = { 0 };
	mii.cbSize = sizeof(mii);
	mii.fMask = MIIM_SUBMENU;
	while (GetMenuItemInfo(*hMenu, iIndex, TRUE, &mii)) {
		if (mii.hSubMenu != NULL)
			DestroyMenu(mii.hSubMenu);
		RemoveMenu(*hMenu, iIndex, MF_BYPOSITION);
	}
}
示例#4
0
/*
 * LanguageExit:  Free language menu when game exited.
 */
void LanguageExit(void)
{
   // Remove "Language" menu.
   if (language_menu != NULL)
   {
      RemoveMenu(cinfo->main_menu, MENU_POSITION_LANGUAGE, MF_BYPOSITION);
      DrawMenuBar(cinfo->hMain);
      DestroyMenu(language_menu);
   }

   language_menu = NULL;
}
示例#5
0
void DestroyTrayMenu(HMENU hMenu)
{
	int i, cnt;

	cnt = GetMenuItemCount(hMenu);
	for (i = 0; i < cnt; ++i) {
		HMENU hSubMenu = GetSubMenu(hMenu, i);
		if (hSubMenu == hMainStatusMenu || hSubMenu == hMainMenu)
			RemoveMenu(hMenu, i--, MF_BYPOSITION);
	}
	DestroyMenu(hMenu);
}
示例#6
0
文件: OMenu.cpp 项目: strogo/StrongDC
OMenu::~OMenu() {
	if (::IsMenu(m_hMenu)) {
		while(GetMenuItemCount() != 0)
			RemoveMenu(0, MF_BYPOSITION);
	} else {
		// How can we end up here??? it sure happens sometimes..
		for (OMenuItem::Iter i = items.begin(); i != items.end(); ++i) {
			delete *i;
		}
	}
	//pUnMap();
}
示例#7
0
文件: grmain.c 项目: DanBurton/racket
static void MrEdSchemeMessages(char *msg, ...)
{
  GC_CAN_IGNORE va_list args;
  
  scheme_start_atomic();

  XFORM_HIDE_EXPR(va_start(args, msg));

  if (!console_out) {
    AllocConsole();
    console_out = GetStdHandle(STD_OUTPUT_HANDLE);

    if (!wx_in_terminal) {
      has_stdio = 1;
      waiting_sema = CreateSemaphore(NULL, 0, 1, NULL);
      orig_signal_handle = scheme_get_signal_handle();
      orig_break_handle = scheme_get_main_thread_break_handle();
      SetConsoleCtrlHandler(ConsoleHandler, TRUE);      

      {
	HMODULE hm;
	gcw_proc gcw;

	hm = LoadLibrary("kernel32.dll");
	if (hm)
	  gcw = (gcw_proc)GetProcAddress(hm, "GetConsoleWindow");
	else
	  gcw = NULL;
    
	if (gcw)
	  console_hwnd = gcw();
      }

      if (console_hwnd) {
	EnableMenuItem(GetSystemMenu(console_hwnd, FALSE), SC_CLOSE,
		       MF_BYCOMMAND | MF_GRAYED);
	RemoveMenu(GetSystemMenu(console_hwnd, FALSE), SC_CLOSE, MF_BYCOMMAND);
      }
    }
  }

  if (!msg) {
    char *s;
    intptr_t l, d;
    DWORD wrote;

    s = va_arg(args, char*);
    d = va_arg(args, intptr_t);
    l = va_arg(args, intptr_t);

    WriteConsole(console_out, s XFORM_OK_PLUS d, l, &wrote, NULL);
  } else {
示例#8
0
LONG CTEKWindow::OnChangeMenu(UINT wParam, LONG lParam)
{
	HMENU SysMenu;
	BOOL Show, B1, B2;

	Show = (ts.PopupMenu==0) && (ts.HideTitle==0);
	if (Show != (MainMenu!=NULL)) {
		if (! Show) {
			if (WinMenu!=NULL) {
				DestroyMenu(WinMenu);
			}
			WinMenu = NULL;
			DestroyMenu(MainMenu);
			MainMenu = NULL;
		}
		else {
			InitMenu(&MainMenu);
		}

		tk.AdjustSize = TRUE;
		::SetMenu(tk.HWin, MainMenu);
		::DrawMenuBar(HTEKWin);
	}

	B1 = ((ts.MenuFlag & MF_SHOWWINMENU)!=0);
	B2 = (WinMenu!=NULL);
	if ((MainMenu!=NULL) &&
	    (B1 != B2)) {
		if (WinMenu==NULL) {
			WinMenu = CreatePopupMenu();
			get_lang_msg("TEKMENU_WINDOW", ts.UIMsg, sizeof(ts.UIMsg), "&Window", ts.UILanguageFile);
			::InsertMenu(MainMenu,4,
			             MF_STRING | MF_ENABLED | MF_POPUP | MF_BYPOSITION,
			             (int)WinMenu, ts.UIMsg);
		}
		else {
			RemoveMenu(MainMenu,4,MF_BYPOSITION);
			DestroyMenu(WinMenu);
			WinMenu = NULL;
		}
		::DrawMenuBar(HTEKWin);
	}

	::GetSystemMenu(tk.HWin,TRUE);
	if ((! Show) && ((ts.MenuFlag & MF_NOSHOWMENU)==0)) {
		SysMenu = ::GetSystemMenu(tk.HWin,FALSE);
		AppendMenu(SysMenu, MF_SEPARATOR, 0, NULL);
		get_lang_msg("TEKMENU_SHOW_MENUBAR", ts.UIMsg, sizeof(ts.UIMsg), "Show menu &bar", ts.UILanguageFile);
		AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, ts.UIMsg);
	}
	return 0;
}
示例#9
0
void UpdateRW_RMenu(HMENU menu, unsigned int mitem, unsigned int baseid)
{
	MENUITEMINFO moo;
	int x;

	moo.cbSize = sizeof(moo);
	moo.fMask = MIIM_SUBMENU | MIIM_STATE;

	GetMenuItemInfo(GetSubMenu(ramwatchmenu, 0), mitem, FALSE, &moo);
	moo.hSubMenu = menu;
	moo.fState = strlen(rw_recent_files[0]) ? MFS_ENABLED : MFS_GRAYED;

	SetMenuItemInfo(GetSubMenu(ramwatchmenu, 0), mitem, FALSE, &moo);

	// Remove all recent files submenus
	for(x = 0; x < MAX_RECENT_WATCHES; x++)
	{
		RemoveMenu(menu, baseid + x, MF_BYCOMMAND);
	}

	// Recreate the menus
	for(x = MAX_RECENT_WATCHES - 1; x >= 0; x--)
	{  
		char tmp[128 + 5];

		// Skip empty strings
		if(!strlen(rw_recent_files[x]))
		{
			continue;
		}

		moo.cbSize = sizeof(moo);
		moo.fMask = MIIM_DATA | MIIM_ID | MIIM_TYPE;

		// Fill in the menu text.
		if(strlen(rw_recent_files[x]) < 128)
		{
			sprintf(tmp, "&%d. %s", ( x + 1 ) % 10, rw_recent_files[x]);
		}
		else
		{
			sprintf(tmp, "&%d. %s", ( x + 1 ) % 10, rw_recent_files[x] + strlen( rw_recent_files[x] ) - 127);
		}

		// Insert the menu item
		moo.cch = strlen(tmp);
		moo.fType = 0;
		moo.wID = baseid + x;
		moo.dwTypeData = tmp;
		InsertMenuItem(menu, 0, 1, &moo);
	}
}
示例#10
0
static void OnInitMenu(HWND hWnd)
{
    LONG lResult;
    HKEY hKey = NULL;
    DWORD dwIndex, cbValueName, cbValueData, dwType;
    TCHAR szValueName[256];
    BYTE abValueData[256];
    static int s_nFavoriteMenuSubPos = -1;
    HMENU hMenu;
    BOOL bDisplayedAny = FALSE;

    /* Find Favorites menu and clear it out */
    hMenu = GetSubMenu(GetMenu(hWnd), FAVORITES_MENU_POSITION);
    if (!hMenu)
        goto done;
    if (s_nFavoriteMenuSubPos < 0)
    {
        s_nFavoriteMenuSubPos = GetMenuItemCount(hMenu);
    }
    else
    {
        while(RemoveMenu(hMenu, s_nFavoriteMenuSubPos, MF_BYPOSITION))
            ;
    }

    lResult = RegOpenKey(HKEY_CURRENT_USER, s_szFavoritesRegKey, &hKey);
    if (lResult != ERROR_SUCCESS)
        goto done;

    dwIndex = 0;
    do
    {
        cbValueName = COUNT_OF(szValueName);
        cbValueData = sizeof(abValueData);
        lResult = RegEnumValue(hKey, dwIndex, szValueName, &cbValueName, NULL, &dwType, abValueData, &cbValueData);
        if ((lResult == ERROR_SUCCESS) && (dwType == REG_SZ))
        {
            if (!bDisplayedAny)
            {
                AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
                bDisplayedAny = TRUE;
            }
            AppendMenu(hMenu, 0, ID_FAVORITES_MIN + GetMenuItemCount(hMenu), szValueName);
        }
        dwIndex++;
    }
    while(lResult == ERROR_SUCCESS);

done:
    if (hKey)
        RegCloseKey(hKey);
}
示例#11
0
void RefreshNavigMenu( intf_thread_t *p_intf, HMENU hMenu )
{
#define MAX_NAVIG_ITEMS 10

    vlc_object_t *p_object;
    char *ppsz_varnames[MAX_NAVIG_ITEMS];
    vlc_object_t * pi_objects[MAX_NAVIG_ITEMS];
    int i;

    /* Delete old menu */
    int count = wce_GetMenuItemCount( hMenu );
    for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION );
 
    if( p_intf->p_sys->p_navig_menu )
        MenuItemExt::ClearList( p_intf->p_sys->p_navig_menu );
    else p_intf->p_sys->p_navig_menu = new vector<MenuItemExt*>;

    /* Initializations */
    memset( pi_objects, 0, MAX_NAVIG_ITEMS * sizeof(vlc_object_t *) );
    i = 0;

    p_object = (vlc_object_t *)
        vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
    if( p_object != NULL )
    {
        ppsz_varnames[i] = "title";
        pi_objects[i++] = p_object;
        ppsz_varnames[i] = "chapter";
        pi_objects[i++] = p_object;
        ppsz_varnames[i] = "program";
        pi_objects[i++] = p_object;
        ppsz_varnames[i] = "navigation";
        pi_objects[i++] = p_object;
        ppsz_varnames[i] = "dvd_menus";
        pi_objects[i++] = p_object;

        ppsz_varnames[i] = "prev-title";
        pi_objects[i++] = p_object;
        ppsz_varnames[i] = "next-title";
        pi_objects[i++] = p_object;
        ppsz_varnames[i] = "prev-chapter";
        pi_objects[i++] = p_object;
        ppsz_varnames[i] = "next-chapter";
        pi_objects[i++] = p_object;

        vlc_object_release( p_object );
    }

    /* Build menu */
    RefreshMenu( p_intf, p_intf->p_sys->p_navig_menu, hMenu, i,
                 ppsz_varnames, pi_objects, NavigMenu_Events );
}
示例#12
0
void
populate_history_popup (void)
{
    int i;
    for (i = 0; i < RIPLIST_LEN; i++) {
	RemoveMenu (m_hmenu_context_sub, ID_MENU_HISTORY_LIST+i, MF_BYCOMMAND);
    }
    for (i = 0; i < RIPLIST_LEN; i++) {
	if (g_gui_prefs.riplist[i][0]) {
	    AppendMenu (m_hmenu_context_sub, MF_ENABLED | MF_STRING, ID_MENU_HISTORY_LIST+i, g_gui_prefs.riplist[i]);
	}
    }
}
示例#13
0
文件: Menu.c 项目: xpika/winhugs
static void hugsprim_RemoveMenu_30(HugsStackPtr hugs_root)
{
    HsPtr arg1;
    HsWord32 arg2;
    HsWord32 arg3;
    HsBool res1;
    arg1 = hugs->getPtr();
    arg2 = hugs->getWord32();
    arg3 = hugs->getWord32();
    res1 = RemoveMenu(arg1, arg2, arg3);
    hugs->putBool(res1);
    hugs->returnIO(hugs_root,1);
}
示例#14
0
void playermenu_populate( )
{
   HMENU menu = client::playermenu_menu( );
   if (menu)
   {
      assert( GetMenuItemCount( menu ) > 0 );

      MENUITEMINFO mii;
      memset( &mii, 0, sizeof( mii ) );
      mii.cbSize = sizeof( mii );

      /* Remove all the stuff we added. */
      {
         unsigned n = GetMenuItemCount( menu );
         mii.fMask = MIIM_DATA;
         for (unsigned i = 0; i < n; ++i)
         {
            GetMenuItemInfo( menu, i, TRUE, &mii );
            if (mii.dwItemData == 1337)
            {
               RemoveMenu( menu, i, MF_BYPOSITION );
               --n; --i;
            }
         }
      }      

      mii.fMask      = MIIM_FTYPE | MIIM_STRING | MIIM_SUBMENU | MIIM_STRING | MIIM_DATA;
      mii.fType      = MFT_STRING;
      mii.dwItemData = 1337;
      bool added = false;

      for (vector<MODULE*>::const_iterator i = g_modules.begin( ); i != g_modules.end( ); ++i)
      {
         if ((*i)->menu && GetMenuItemCount( (*i)->menu ) > 0)
         {
            mii.dwTypeData = const_cast<char*>( (*i)->fancy_name.c_str( ) );
            mii.hSubMenu = (*i)->menu;
            InsertMenuItem( menu, GetMenuItemCount( menu ) - 1, TRUE, &mii );
            added = true;
         }
      }

      if (added)
      {
         /* Insert a separator before the shortname. */
         mii.fMask  = MIIM_TYPE | MIIM_DATA;
         mii.fType  = MFT_SEPARATOR;
         InsertMenuItem( menu, GetMenuItemCount( menu ) - 1, TRUE, &mii );
      }
   }
}
示例#15
0
//*************************************************************
//
//  PlaceMenuMRUItem()
//
//  Purpose:
//              Add MRU at the end of a menu
//
//  Parameters:
//      LPMRUMENU lpMruMenu -      pointer on MRUMENU
//      HMENU hMenu -              Handle of menu where MRU must be added
//      UINT uiItem -              Item of menu entry where MRU must be added
//
//  Return: void
//
//
//  Comments:
//      Used MRU is modified, for refresh the File menu
//
//  History:    Date       Author       Comment
//              09/24/94   G. Vollant   Created
//
//*************************************************************
void PlaceMenuMRUItem (LPMRUMENU lpMruMenu, HMENU hMenu, UINT uiItem)
{
int  i;   
WORD wNbShow;

	if (hMenu == NULL) return;

// "Liste ..." entfernen
	RemoveMenu (hMenu, lpMruMenu->wIdMru-1, MF_BYCOMMAND);

// remove old MRU in menu
	for (i = 0; i <= (int)(lpMruMenu->wNbLruMenu); i++)
		RemoveMenu (hMenu, i+lpMruMenu->wIdMru, MF_BYCOMMAND);

// If they are item, insert a separator before the files
	InsertMenu (hMenu,uiItem,MF_SEPARATOR,lpMruMenu->wIdMru,NULL);
  
	if (lpMruMenu->wNbItemFill == 0) {
	ResString resMRU (IDS_EMPTYMRU, 32);

		InsertMenu (hMenu, lpMruMenu->wIdMru, MF_STRING|MF_GRAYED, 
				    lpMruMenu->wIdMru-1, resMRU);
	} else {
		wNbShow = min(lpMruMenu->wNbItemFill,lpMruMenu->wNbLruShow);
		for (i = (int)wNbShow-1; i >= 0; i--) {
		LPSTR lpTxt = new char [lpMruMenu->wMaxSizeLruItem + 20];
			
			if (lpTxt) {
				wsprintf (lpTxt,"&%lu %s",
							(DWORD)(i+1), 
							lpMruMenu->lpMRU + (lpMruMenu->wMaxSizeLruItem*(UINT)i));
				InsertMenu (hMenu,(((WORD)i) != (wNbShow-1)) ? (lpMruMenu->wIdMru+i+2) : lpMruMenu->wIdMru,
						MF_STRING, lpMruMenu->wIdMru+i+1,lpTxt);   
				delete lpTxt;
			}
		}
	}
}
示例#16
0
void ProductList::ShowRMenu()
{
	HMENU hMenu = LoadMenu(IDR_MENU_PRODUCT);
	HMENU hMenuPop = GetSubMenu(hMenu, 0);

	if (GetCount() == 0)
	{
		RemoveMenu(hMenuPop, 1, MF_BYPOSITION);	//删除分隔线
		RemoveMenu(hMenuPop, 1, MF_BYPOSITION);	//删除导出列表
	}
	else if(GetCount() == 1)
		if(GetText(0) == TEXT("<null>"))
			return ;

	SendMessage(getParent(), NM_SETPOPMENULANG, (WPARAM)hMenuPop, (LPARAM)"Product");

	POINT pt;
	::GetCursorPos(&pt);

	::TrackPopupMenuEx(hMenuPop, TPM_BOTTOMALIGN, pt.x, pt.y, getParent(), 0);

	::DestroyMenu(hMenuPop);
}
示例#17
0
void InitTrayCBWnd(BOOL bCreate)
{
	LONG i, lMMItemCnt, lTMItemCnt;
	if (bCreate)
	{
		WCHAR lpwText[MAX_PATH] = { 0 };
		hTrayMenu = CreatePopupMenu();
		AppendMenu(hTrayMenu, MF_STRING, IDM_TRAY_HIDESHOW, L"&Hide/Show Player");
		AppendMenu(hTrayMenu, MF_SEPARATOR, 0, 0);
		lMMItemCnt = GetMenuItemCount(GetMenu(hMainWnd));
		for (i = 0; i < lMMItemCnt; i++)
		{
			GetMenuString(GetMenu(hMainWnd), i, lpwText, MAX_PATH, MF_BYPOSITION);
			AppendMenu(hTrayMenu, MF_STRING | MF_POPUP, (UINT_PTR)GetSubMenu(GetMenu(hMainWnd),
				i), lpwText);
		}
		SetMenuDefaultItem(hTrayMenu, IDM_TRAY_HIDESHOW, FALSE);
		WCEX.cbSize = sizeof(WNDCLASSEX); 
		WCEX.lpfnWndProc = (WNDPROC)TrayCBWndProc;
		WCEX.hInstance = hAppInstance;
		WCEX.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
		WCEX.lpszClassName = TRAY_CB_WND_CLASS;
		RegisterClassEx(&WCEX);
		hTrayCBWnd = CreateWindow(WCEX.lpszClassName, 0, WS_POPUP,
			16, 16, 32, 32, 0, hTrayMenu, hAppInstance, 0);
		if (!dwNoOwnerDrawMenu)
		{
			pEBMenuTray->hBmpCheck = (HBITMAP)LoadImage(hAppInstance, MAKEINTRESOURCE(IDB_CHECKMARK),
				IMAGE_BITMAP, 16, 16, 0);
			pEBMenuTray->hBmpRadioCheck = (HBITMAP)LoadImage(hAppInstance, MAKEINTRESOURCE(IDB_RADIOCHECKMARK),
				IMAGE_BITMAP, 16, 16, 0);
			pEBMenuTray->InitEBMenu(hTrayCBWnd, TRUE);
		}
	}
	else
	{
		if (!dwNoOwnerDrawMenu) pEBMenuTray->InitEBMenu(0);
		lMMItemCnt = GetMenuItemCount(GetMenu(hMainWnd));
		lTMItemCnt = GetMenuItemCount(hTrayMenu);
		for (i = (lTMItemCnt - 1); i >= (lTMItemCnt - lMMItemCnt); i--)
		{
			RemoveMenu(hTrayMenu, i, MF_BYPOSITION);
		}
		DestroyMenu(hTrayMenu);
		hTrayMenu = 0;
		DestroyWindow(hTrayCBWnd);
		hTrayCBWnd = 0;
	}
}
示例#18
0
文件: olemisc.cpp 项目: Rupan/winscp
void AFXAPI AfxUnmergeMenus(HMENU hMenuShared, HMENU hMenuSource,
	HMENU hHelpMenuPopup /* = NULL */)
{
	ASSERT(hMenuShared != NULL && IsMenu(hMenuShared));
	ASSERT(hMenuSource != NULL && IsMenu(hMenuSource));
	ASSERT(hHelpMenuPopup == NULL || IsMenu(hHelpMenuPopup));

	int cOurItems = GetMenuItemCount(hMenuSource);
	int cMenuItems = GetMenuItemCount(hMenuShared);

	for (int i = cMenuItems-1; i >= 0; i--)
	{
		// check out the popup menus
		HMENU hMenuPopup = ::GetSubMenu(hMenuShared, i);
		if (hMenuPopup != NULL)
		{
			// if we have a Help submenu, check to see if it appears in this
			// submenu someplace... this normally happens only in
			// DocObject frame windows

			if (hHelpMenuPopup != NULL)
			{
				int cPopupItems = ::GetMenuItemCount(hMenuPopup);
				for (int k = 0; k < cPopupItems; k++)
				{
					if (::GetSubMenu(hMenuPopup, k) == hHelpMenuPopup)
					{
						::RemoveMenu(hMenuPopup, k, MF_BYPOSITION);
						hHelpMenuPopup = NULL;  // can only have one
						break;
					}
				}
			}
			else
			{
				// if it is one of ours, remove it from the pMenuShared
				for (int j = 0; j < cOurItems; j++)
				{
					if (::GetSubMenu(hMenuSource, j) == hMenuPopup)
					{
						// remove the menu from pMenuShared
						RemoveMenu(hMenuShared, i, MF_BYPOSITION);
						break;
					}
				}
			}
		}
	}
}
示例#19
0
RemoteDesktop::CConsole::CConsole() : m_OwnConsole(false) {
	if (!AllocConsole()) return;

	SetConsoleCtrlHandler(MyConsoleCtrlHandler, TRUE);
	RemoveMenu(GetSystemMenu(GetConsoleWindow(), FALSE), SC_CLOSE, MF_BYCOMMAND);
	const int in = _open_osfhandle(INT_PTR(GetStdHandle(STD_INPUT_HANDLE)), _O_TEXT);
	const int out = _open_osfhandle(INT_PTR(GetStdHandle(STD_OUTPUT_HANDLE)), _O_TEXT);
	m_OldStdin = *stdin;
	m_OldStdout = *stdout;
	auto sr = *stdout;
	*stdin = *_fdopen(in, "r");
	*stdout = *_fdopen(out, "w");

	m_OwnConsole = true;
}