Thread: Fullscreen application with DevC++

  1. #1
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342

    Question Fullscreen application with DevC++

    How do I make a fullscreen application with DevC++ without using OpenGL or GLUT or DirectX?
    Thanks, August.

  2. #2
    return 0;
    Join Date
    Jan 2005
    Location
    Netherlands
    Posts
    89
    This works:

    Code:
    DEVMODE screen;
    screen.dmBitsPerPel = 32;
    screen.dmPelsWidth  = WIDTH;
    screen.dmPelsHeight = HEIGHT;
    screen.dmFields     = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
    
    if(ChangeDisplaySettings(&screen, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) {
        // Fullscreen failed
        return 0;
    }
    Position your window at (0, 0) and make it WIDTH wide and HEIGHT high so it covers the entire screen.

  3. #3
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    I changed it to this:


    Code:
    DEVMODE screen;
    screen.dmBitsPerPel = 32;
    screen.dmPelsWidth  = GetSystemMetrics(SM_CYSCREEN);
    screen.dmPelsHeight = GetSystemMetrics(SM_CXSCREEN);
    screen.dmFields     = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
    
    if(ChangeDisplaySettings(&screen, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) {
        // Fullscreen failed
        return 0;
    }
    But it failed! How come?

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    How do I make a fullscreen application with DevC++ without using OpenGL or GLUT or DirectX?
    If all you need to do is set your window dimensions to the same as your current desktop then just use GetSystemMetrics to get the desktop width and height and use these to create your window (or use SetWindowPos or MoveWindow after window creation).

    If you are using ChangeDisplaySettings then its probably best to use EnumDisplaySettings first to fill out a viable DEVMODE struct for your target machine.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  5. #5
    return 0;
    Join Date
    Jan 2005
    Location
    Netherlands
    Posts
    89
    Quote Originally Posted by Cool-August
    ...

    But it failed! How come?
    You've switched width and height values.

  6. #6
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    I don't get it I swiched the width and height values, now it goes fullscreen black. Then t goes back to a window.
    I am getting confused. So could you just tell me how to get rid of the title bar on a window?

  7. #7
    return 0;
    Join Date
    Jan 2005
    Location
    Netherlands
    Posts
    89
    I just tried Ken's solution and that works just as fine (or better, since you need less code), so you don't need to use ChangeDisplaySettings. Just use WS_POPUP as your window style, and set the width and height of your window to the width and height of the screen:

    Code:
    HWND window = CreateWindow(
                            TEXT("Class"),
                            NULL, // WS_POPUP has no title bar
                            WS_POPUP, // No title bar or border
                            0, 0, // Position the window at the topleft
                            GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
                            NULL,
                            NULL,
                            hInstance,
                            NULL);

  8. #8
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Thanks, thats just what I wanted.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  2. Real fullscreen application
    By maxorator in forum Windows Programming
    Replies: 5
    Last Post: 11-05-2005, 10:43 AM
  3. Problem with com application
    By amardon in forum C++ Programming
    Replies: 3
    Last Post: 10-06-2005, 05:50 AM
  4. MFC run application by clicking on file...
    By dug in forum Windows Programming
    Replies: 4
    Last Post: 12-02-2004, 04:33 AM