News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Restoring the Previous Display Mode in DirectDraw

Started by satpro, October 04, 2014, 01:20:15 AM

Previous topic - Next topic

satpro

I'm working on a project in which the resolution is changed to sort of a "hard-coded" 1280x720.  Let's say the previous resolution was 1920x1080.  When my program returns to 1920x1080, all the windows will be re-sized smaller, which will be very annoying to the user of the program.  I'm using DirectDraw for "nostalgia" on this one (and realize there are newer Dx versions which make the return to Windows much more automatic).

Is there a "trick" as far as the ordering of the shutdown calls to make the return to the original display mode less disruptive, or some Windows message I can work with?

Thank you

dedndave


AnDino

I'm not quite sure what you're getting at in your question, but...

IDirectDraw7::SetDisplayMode()

HRESULT SetDisplayMode(DWORD dwWidth
               DWORD dwHeight,
               DWORD dwBPP,    // bits per pixel
               DWORD dwRefreshRate,
               DWORD dwFlags);


Maybe try calling/invoking it somewhere before releasing your interface?


satpro

AnDino:
Thank you.  There is RestoreDisplayMode for that.  MS recommends against trying to restore the old mode yourself with SetDisplayMode.

Dave:
Thanks.  You gave me an idea how to tackle this.  In the beginning I had it in the user's resolution, which worked but had stretching issues, so I tried changing the resolution, which works but has the window-resizing problem (if the window is maximized).  I think I might have a way around it now.  It has to be exact pixels, so no stretching or shrinking.  It's in how I'm doing the blits (they should have a bounding rectangle that is NOT the size of the display)

dedndave

right - best to let the user decide some things, and your code should adapt to their world - lol
it's not always practical
what you might do is display a message that says, "best if xxx minimum resolution is used"