Thread: Console Functions Help

  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    49

    Console Functions Help

    Hello, I always heard that you can not do graphics in windows 32 console. But I found this Function that says something abuot switching to Full Screen with hardware.
    GetConsoleDisplayMode
    Link
    http://msdn.microsoft.com/library/en...splaymode.asp?

    GetConsoleDisplayMode

    The GetConsoleDisplayMode function retrieves the display mode of the current console.


    BOOL GetConsoleDisplayMode(
    LPDWORD lpModeFlags
    );

    Parameters
    lpModeFlags
    [out] Display mode of the console. This parameter can be one or more of the following values. Value Meaning
    CONSOLE_FULLSCREEN Full-screen console. The console is in this mode as soon as the window is maximized. At this point, the transition to full-screen mode can still fail.
    CONSOLE_FULLSCREEN_HARDWARE Full-screen console communicating directly with the video hardware. This mode is set after the console is in CONSOLE_FULLSCREEN mode to indicate that the transition to full-screen mode has completed.

    Does this mean that You can Use SetConsoleDispayMode? And do Graphics in Console mode?

    And How do you use Console functions? I tried passing the function CONSOLE_FULLSCREEN Full? but it didnt work.

    Thanks. I would like to understand how to understand how to use Functions from the documentation
    Byebye Have a good day and Thanks for Looking

  2. #2
    Hello,

    Using these Console functions take different codes per operating system, to my knowledge. Sadly, I don't believe there is a simple way to change a console to fullscreen using one variable.

    Also, from short research, there are very few documents pertaining this matter. The MSDN is a good reference, but sometimes fails to show pseudo-code.

    Though, one of the lasting links I have handy exist: How to switch a console window to fullscreen mode

    I'm not sure how much more information I can provide. I do hope this helps.


    - Stack Overflow
    Segmentation Fault: I am an error in which a running program attempts to access memory not allocated to it and core dumps with a segmentation violation error. This is often caused by improper usage of pointers, attempts to access a non-existent or read-only physical memory address, re-use of memory if freed within the same scope, de-referencing a null pointer, or (in C) inadvertently using a non-pointer variable as a pointer.

  3. #3
    Registered User
    Join Date
    Nov 2004
    Posts
    49
    Do you know if you can do graphics in full screen mode? and how to do it? What can you do in fullscreen mode? is it just a bigger screen or can you acccess the video memory and do graphics? Ill look over the code you found. Its good. I found some other code but it was in a different language. http://forum.builder.cz/read.php?f=23&i=12485&t=12395
    Maybe you can make sense of it. all the code is regular C++ stuff. The printf stuff is just in another language.

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    >> Do you know if you can do graphics in full screen mode?
    ASCII graphics

    Here's a nice tutorial on console programming in Win32:
    http://www.adrianxw.dk/SoftwareSite/...Consoles1.html

    As for making your console window fullscreen, I like my code the best
    http://cboard.cprogramming.com/showthread.php?t=49825

    gg

  5. #5
    Registered User
    Join Date
    Nov 2004
    Posts
    49
    If you can only do ASci graphics, Why does it say CONSOLE_FULLSCREEN_HARDWARE Full-screen console communicating directly with the video hardware. What does that mean? Thanks for all the replies and links. I dont understand how to use the functions so its confusing.

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    All it really means is that the hardware video mode is changed to "full-screen text" mode.

    gg

  7. #7
    Registered User manofsteel972's Avatar
    Join Date
    Mar 2004
    Posts
    317
    That is a flag returned by the GetConsoleDisplayMode() function it is to let you know that the mode was set to fullscreen and was completed and did not fail. it requires WINXP or better to work.
    SetConsoleDisplayMode(hStdout,CONSOLE_FULLSCREEN_M ODE); will set the console to fullscreen

    [edit]
    changes to post in red Yeah I know it is availble in NT too :P
    Last edited by manofsteel972; 12-04-2004 at 03:54 AM.
    "Knowledge is proud that she knows so much; Wisdom is humble that she knows no more."
    -- Cowper

    Operating Systems=Slackware Linux 9.1,Windows 98/Xp
    Compilers=gcc 3.2.3, Visual C++ 6.0, DevC++(Mingw)

    You may teach a person from now until doom's day, but that person will only know what he learns himself.

    Now I know what doesn't work.

    A problem is understood by solving it, not by pondering it.

    For a bit of humor check out xkcd web comic http://xkcd.com/235/

  8. #8
    Registered User
    Join Date
    Nov 2004
    Posts
    49
    Yes I have Windows Xp, Are you sure you have All the code there? What is hStdout?
    I dont get how to pass the arguments and use the functions on some of these. Here is the code I have.
    Code:
    #include <windows.h>
    #include <Wincon.h>
    #include <iostream>
    using namespace std;
    
    #define _WIN32_WINNT 0x0500 
    extern BOOL GetConsoleDisplayMode(LPDWORD lpModeFlags);
    extern CONSOLE_FULLSCREEN;
    extern CONSOLE_FULLSCREEN_MODE;
    extern BOOL SetConsoleDisplayMode(HANDLE hConsoleOutput,DWORD dwFlags,PCOORD lpNewScreenBufferDimensions);
    
    int main () {
    SetConsoleDisplayMode(hStdout,CONSOLE_FULLSCREEN_MODE); 
    	if(GetConsoleDisplayMode(hStdout,CONSOLE_FULLSCREEN)){
    cout<<"FullScreen"<<endl;
    	}
    
    system("PAUSE");
    	return 0;
    }
    When I try to use your code it says hStdout is unknown or something. and When I try to pass CONSOLE_FULLSCREEN to GetConsoleDisplayMode. It says Its the wrong type? What am I doing wrong?

  9. #9
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    >> ...it is for WINXP only...
    It exists in all versions of NT. The Platform SDK has only advertised it on XP.

    >> What is hStdout?
    You'll want to learn basic C/C++ before doing anything with windows.h.
    Once you've done that, click on the links I provided and read them.

    gg

  10. #10
    Registered User manofsteel972's Avatar
    Join Date
    Mar 2004
    Posts
    317
    You need to get a HANDLE to the standard output. so something like
    Code:
    HANDLE hStdout=GetStdHandle(STD_OUTPUT_HANDLE);
     
    you don't have to use hStdout you can name it whatever you want I just use hStdout so I
    know it is an outupt handle that writes to the screen you can also
    get the input handle that you can use to read information from the keyboard
     
    HANDLE hStdin=GetStdHandle(STD_INPUT_HANDLE);
     
    and to get the standard error to write error messages to 
     
    HANDLE hStderr=GetStdHandle(STD_ERROR_HANDLE);
     
    When you are Getting the Display mode you are storing it in a variable.
     
    DWORD FullScreen; or whatever you want to call it.
     
    GetConsoleDisplayMode(hStdout,&FullScreen); //retreives the console mode and stores it in FullScreen variable;
    you can test to see if the call to GetConsoleDisplayMode failed or succeeded by testing its return value.
     
    bool test=GetConsoleDisplayMode(....
    if(test==true)
    //call to GetConsleDisplayMode succeeded
    if(test==False)
    //call to GetConsoleDisplayMode failed must be an error somewhere....
     
     
    Now you can test the mode.
    if(FullScreen==CONSOLE_FULLSCREEN)
    //then it is still in the process of making the console fullscreen
     
    if(FullScreen==CONSOLE_FULLSCREEN_HARDWARE)
    //then the switch to fullscreen is complete
    Last edited by manofsteel972; 12-04-2004 at 04:07 AM.
    "Knowledge is proud that she knows so much; Wisdom is humble that she knows no more."
    -- Cowper

    Operating Systems=Slackware Linux 9.1,Windows 98/Xp
    Compilers=gcc 3.2.3, Visual C++ 6.0, DevC++(Mingw)

    You may teach a person from now until doom's day, but that person will only know what he learns himself.

    Now I know what doesn't work.

    A problem is understood by solving it, not by pondering it.

    For a bit of humor check out xkcd web comic http://xkcd.com/235/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. exchange functions demo code
    By kryptkat in forum C++ Programming
    Replies: 0
    Last Post: 04-05-2009, 02:06 PM
  2. An array of macro functions?
    By someprogr in forum C Programming
    Replies: 6
    Last Post: 01-28-2009, 07:05 PM
  3. Passing pointers between functions
    By heygirls_uk in forum C Programming
    Replies: 5
    Last Post: 01-09-2004, 06:58 PM
  4. Attaching functions to a class/struct
    By VirtualAce in forum Tech Board
    Replies: 2
    Last Post: 08-04-2003, 10:56 AM
  5. Console Functions
    By unanimous in forum C++ Programming
    Replies: 1
    Last Post: 12-28-2001, 08:09 PM