Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to adapt window size to screen resolution

How to adapt window size to screen resolution

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gmlnd
    wrote on last edited by
    #1

    I have a FormView based mfc program. I am trying to adjust my program so it can adapt to different screen resolution. I have the following code in my OnDraw function, but it fails to adapt window size on different screen resolution. CRect rc; SystemParametersInfo(SPI_GETWORKAREA,0,rc,0); I don't know what I'm missing, or if there is anything wrong with my code.

    D 1 Reply Last reply
    0
    • G gmlnd

      I have a FormView based mfc program. I am trying to adjust my program so it can adapt to different screen resolution. I have the following code in my OnDraw function, but it fails to adapt window size on different screen resolution. CRect rc; SystemParametersInfo(SPI_GETWORKAREA,0,rc,0); I don't know what I'm missing, or if there is anything wrong with my code.

      D Offline
      D Offline
      Dominik Reichl
      wrote on last edited by
      #2

      I would do it like this:

      RECT rc;
      SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0);

      :) -Dominik


      _outp(0x64, 0xAD); and __asm mov al, 0xAD __asm out 0x64, al do the same... but what do they do?? ;)

      G 1 Reply Last reply
      0
      • D Dominik Reichl

        I would do it like this:

        RECT rc;
        SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0);

        :) -Dominik


        _outp(0x64, 0xAD); and __asm mov al, 0xAD __asm out 0x64, al do the same... but what do they do?? ;)

        G Offline
        G Offline
        gmlnd
        wrote on last edited by
        #3

        I tried this, but it still will not adapt to different screen resolution. Is it okay to have GetSystemMetrics in MainFrame? void CMainFrame::OnMove(int x, int y) { Rect rc; SystemParametersInfo(SPI_GETWORKAREA,0,&rc,0); }

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups