943,884 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 6780
  • C++ RSS
May 19th, 2006
0

Full screen console applications

Expand Post »
Hey,


I have a problem using Visual Studio 2005. In the MSDN library it says there is a function called SetConsoleDisplayMode. This function though is not in the 2005 library. I'm assuming its an old reference from VS 2003. Does anyone know how to tell a console program to switch into full screen mode?

Any help is appreciated.
- Daniel
Similar Threads
Reputation Points: 36
Solved Threads: 2
Junior Poster in Training
nanodano is offline Offline
78 posts
since Feb 2005
May 20th, 2006
0

Re: Full screen console applications

Here's a code snippet which I found.
C++ Syntax (Toggle Plain Text)
  1. #include <windows.h>
  2. #include <iostream>
  3.  
  4. BOOL NT_SetConsoleDisplayMode(HANDLE hOutputHandle, DWORD dwNewMode)
  5. {
  6. typedef BOOL (WINAPI *SCDMProc_t) (HANDLE, DWORD, LPDWORD);
  7. SCDMProc_t SetConsoleDisplayMode;
  8. HMODULE hKernel32;
  9. BOOL bFreeLib = FALSE, ret;
  10. const char KERNEL32_NAME[] = "kernel32.dll";
  11.  
  12. hKernel32 = GetModuleHandleA(KERNEL32_NAME);
  13. if (hKernel32 == NULL)
  14. {
  15. hKernel32 = LoadLibraryA(KERNEL32_NAME);
  16. if (hKernel32 == NULL)
  17. return FALSE;
  18.  
  19. bFreeLib = true;
  20. }//if
  21.  
  22. SetConsoleDisplayMode =
  23. (SCDMProc_t)GetProcAddress(hKernel32, "SetConsoleDisplayMode");
  24. if (SetConsoleDisplayMode == NULL)
  25. {
  26. SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
  27. ret = FALSE;
  28. }//if
  29. else
  30. {
  31. DWORD dummy;
  32. ret = SetConsoleDisplayMode(hOutputHandle, dwNewMode, &dummy);
  33. }//else
  34.  
  35. if (bFreeLib)
  36. FreeLibrary(hKernel32);
  37.  
  38. return ret;
  39. }//NT_SetConsoleDisplayMode
  40.  
  41. int main( void )
  42. {
  43. NT_SetConsoleDisplayMode( GetStdHandle( STD_OUTPUT_HANDLE ), 1 );
  44. std::cin.get();
  45. return 0;
  46. }
SpS
Reputation Points: 70
Solved Threads: 32
Posting Pro
SpS is offline Offline
598 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: my #include <string> wont make "string" bold
Next Thread in C++ Forum Timeline: DLL that returns a pointer





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC