Full screen console applications

Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2005
Posts: 78
Reputation: nanodano is an unknown quantity at this point 
Solved Threads: 2
nanodano's Avatar
nanodano nanodano is offline Offline
Junior Poster in Training

Full screen console applications

 
0
  #1
May 19th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 598
Reputation: SpS is on a distinguished road 
Solved Threads: 32
SpS's Avatar
SpS SpS is offline Offline
Posting Pro

Re: Full screen console applications

 
0
  #2
May 20th, 2006
Here's a code snippet which I found.
  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. }
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 4634 | Replies: 1
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC