Solved

Changing Screen Resolution Through ChangeDisplaySetting() API

Posted on 2002-06-19
5
1,064 Views
Last Modified: 2013-12-03
Hello Experts,

I have made a Win32 GDI Application which runs only in 800*600 Resolution.

I want, when the applicaton runs, if the display settings are other than 800*600, say 1K or might be 640*480, instead of user doing it manually, I want doing it my self through win32 code of the application.

Searching across MSDN I found changedisplaysetting and changedisplaysettingex and other device capable functions, but was not able to achieve the results.

Can anyone tell me exactly, how it can be done from these win32 device-capable API'S.
Also I just want to change the resolution of the screen and nothing else, such as refresh frequency, bit-rate etc.

Please suggest as how to do it.

Best Regards
Austin

0
Comment
Question by:austin123
  • 2
  • 2
5 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 7093721
The display resolution is inter-related with the refresh frequency.  You cannot change one without regard to the other.

You must:

1) Use EnumDisplaySettings to find a permissible display setup for this adapter/display combo.

2) Use ChangeDisplaySettings to actually change the display mode.

I also strongly suggest that you RESTORE the original display setting for the user when you exit your application.
0
 
LVL 32

Expert Comment

by:jhance
ID: 7093729
0
 
LVL 4

Accepted Solution

by:
mblat earned 100 total points
ID: 7093742
Can you post your code?

The following works fine on mine Win2K laptop...

    DEVMODE dm;

    dm.dmSize = sizeof(DEVMODE);
    dm.dmDriverExtra = 0;
    EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&dm);
    dm.dmPelsHeight = 600;
    dm.dmPelsWidth  = 800;
    ChangeDisplaySettings(&dm,0);


Hope it helps....
0
 
LVL 4

Expert Comment

by:mblat
ID: 7093744
Sorry jhance, didn't mean to run on your parade....
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 7094797
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Cannot debug web form sthrough Visual Studio 2013 2 70
Having Trouble with MS Access 2010 CommandBars 19 97
Windows Process running 3 54
Where did System.Data.Objects go? 2 23
This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now