?
Solved

Changing Screen Resolution Through ChangeDisplaySetting() API

Posted on 2002-06-19
5
Medium Priority
?
1,068 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 400 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

762 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