CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2013
    Posts
    77

    Changing screen resolution by program

    Hello Experts,

    I have made a Win32 GDI Application which runs only in 1024*768 Resolution.
    When the application runs on any other resolution, drawings gets disturbed,So i want to restrict the resolution to 1024*768 through program.How to set the resolution to this pixel ,Can i use ChangeDisplaySetting() function to set to a specific pixel?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Changing screen resolution by program

    Quote Originally Posted by manjut19 View Post
    I have made a Win32 GDI Application which runs only in 1024*768 Resolution.
    When the application runs on any other resolution, drawings gets disturbed,So i want to restrict the resolution to 1024*768 through program.
    Why don't you want to fix your code to draw correctly in any other resolution instead?

    Quote Originally Posted by manjut19 View Post
    Can i use ChangeDisplaySetting() function to set to a specific pixel?
    Why don't you want to try it?
    Note however, that it only changes the settings of the default display device! To change the settings of a specified display device, use the ChangeDisplaySettingsEx function.
    Victor Nijegorodov

  3. #3
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: Changing screen resolution by program

    The majority of people won't like your program if it messes around with the desktop resolution.
    it'll also look bad on any LCD screen that doesn't have 1024x768 as native resolution.
    it could cause problems if the screen doesn't even support that resolution.


    As victor said... Fix your app to work properly in any resolution
    if you really need to enforce a resolution, you could consider fullscreen directX, but then you can't use the GDI.

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Changing screen resolution by program

    For one thing, 1024x768 is so yesterday. Any store bought computer out there doesn't run that low of resolution.

    As others have mentioned, changing a user's resolution is a bad idea.

    It's much better (and more professional) to fix your program so it runs under different resolutions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured