iFarbod

console

Aug 5th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1.     AllocConsole();
  2.     AttachConsole(GetCurrentProcessId());
  3.     freopen("CON", "w", stdout);
  4.     freopen("CONIN$", "r", stdin);
  5.  
  6.     // Screens
  7.     // If you have multiple screens, this will automatically move the console to the 2nd
  8.     if (GetSystemMetrics(SM_CMONITORS) > 1)
  9.     {
  10.         // Console Window
  11.         HWND hConsole = GetConsoleWindow();
  12.         RECT rect;
  13.         GetWindowRect(hConsole, &rect);
  14.  
  15.         // Desktop
  16.         HWND hDesktop = GetDesktopWindow();
  17.         RECT rDesktopRect;
  18.         GetWindowRect(hDesktop, &rDesktopRect);
  19.  
  20.         // Update Position
  21.         SetWindowPos(hConsole, nullptr, rDesktopRect.right + 100, 50, rect.right - rect.left, rect.bottom - rect.top, 0);
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment