i am trying to find code that will fullscreen the dos window...i know that its possible but i cant find the code....i'm moderatly sure that it sill involve including the windows.h include file.
This is a discussion on fullscreening the dos window within the C++ Programming forums, part of the General Programming Boards category; i am trying to find code that will fullscreen the dos window...i know that its possible but i cant find ...
i am trying to find code that will fullscreen the dos window...i know that its possible but i cant find the code....i'm moderatly sure that it sill involve including the windows.h include file.
Style is overrated.
- —₽‚¢‰Î -
Here's a little more robust version:If you're running on an NT based verison of Windows, here is the best way to do it:Code:// Simulate ALT-ENTER keystrokes void AltEnter() { // NOTE: This method only works if the console window has the keyboard // focus and the user isn't hitting keys on the keyboard. SetForegroundWindow(GetConsoleWindow()); keybd_event(VK_MENU, MapVirtualKey(VK_MENU, 0), 0, 0); keybd_event(VK_RETURN, MapVirtualKey(VK_RETURN, 0), 0, 0); keybd_event(VK_RETURN, MapVirtualKey(VK_RETURN, 0), KEYEVENTF_KEYUP, 0); keybd_event(VK_MENU, MapVirtualKey(VK_MENU, 0), KEYEVENTF_KEYUP, 0); }//AltEnteradrianxw is more than welcome to clean this up and use it in his tutorialsCode:/*----------------------------------------------------------------------------- NT_SetConsoleDisplayMode - Set the console display to fullscreen or windowed. Parameters: hOutputHandle - Output handle of cosole, usually "GetStdHandle(STD_OUTPUT_HANDLE)" dwNewMode - 0=windowed, 1=fullscreen Returns Values: TRUE if successful, otherwise FALSE is returned. Call GetLastError() for extened information. Remarks: This only works on NT based versions of Windows. If dwNewMode is anything other than 0 or 1, FALSE is returned and GetLastError() returns ERROR_INVALID_PARAMETER. If dwNewMode specfies the current mode, FALSE is returned and GetLastError() returns ERROR_INVALID_PARAMETER. Use the (documented) function GetConsoleDisplayMode() to determine the current display mode. -----------------------------------------------------------------------------*/ BOOL NT_SetConsoleDisplayMode(HANDLE hOutputHandle, DWORD dwNewMode) { typedef BOOL (WINAPI *SCDMProc_t) (HANDLE, DWORD, LPDWORD); SCDMProc_t SetConsoleDisplayMode; HMODULE hKernel32; BOOL bFreeLib = FALSE, ret; const char KERNEL32_NAME[] = "kernel32.dll"; hKernel32 = GetModuleHandleA(KERNEL32_NAME); if (hKernel32 == NULL) { hKernel32 = LoadLibraryA(KERNEL32_NAME); if (hKernel32 == NULL) return FALSE; bFreeLib = true; }//if SetConsoleDisplayMode = (SCDMProc_t)GetProcAddress(hKernel32, "SetConsoleDisplayMode"); if (SetConsoleDisplayMode == NULL) { SetLastError(ERROR_CALL_NOT_IMPLEMENTED); ret = FALSE; }//if else { DWORD dummy; ret = SetConsoleDisplayMode(hOutputHandle, dwNewMode, &dummy); }//else if (bFreeLib) FreeLibrary(hKernel32); return ret; }//NT_SetConsoleDisplayMode
gg