Windows settings that affect screen layout

Posted on 2012-08-27
Medium Priority
Last Modified: 2012-08-27
The way my app looks on various PCs screens is affected by:

1) the number of pixels of the display
2) the DPI setting (in windows graphics preferences)
3) what else?

because, although it displays fine on 95% of PCs, I sometimes find one where the layout of the controls is weird, overlapping, etc.   I've seen it now recently on a couple of 1366x768 win7 screens, and I can't figure out why -- what is differnet about settings on those PCs?? Or is it a problem or setting assocaited with a graphics card?  Finally, I have seen this a few times on PCs in asian countries that try running my app -- so maybe something that is configurable about fonts...

Anyway, the question is, I read the screen size and DPI in my code, and then I attempt to "do the right thing" to make the layout look nice and fit on the screen.  What other parameters are there that I should be able to detect and do something about?

My app is MS Visual C++ using MFC.

Question by:tullhead
  • 4
  • 3
LVL 86

Expert Comment

ID: 38337517
>> 3) what else?

E.g. the System Font plus its size as well as the the NONCLIENTMETRICS (http://msdn.microsoft.com/en-us/library/windows/desktop/ff729175(v=vs.85).aspx)

Author Comment

ID: 38337574
JKR --  Hmmm....  I suppose it is not cool for my app to "set" these values, as they are system wide, correct?

Author Comment

ID: 38337595
JKR - could you show me a code snippet on how I grab this sctructure?
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

LVL 86

Accepted Solution

jkr earned 2000 total points
ID: 38338112
Setting them? No, certainly not, but I thought of evaluating them. Grabbing that struct works via 'SystemParametersInfo()' and SPI_GETNONCLIENTMETRICS, e.g.
ncm.cbSize = sizeof(NONCLIENTMETRICS);

SystemParametersInfo(NONCLIENTMETRICS, ncm.cbSize,(PVOID)&ncm,FALSE);

Open in new window


Author Comment

ID: 38338239
Thanks.  I think you meant to have the first argument like this:

    SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize,(PVOID)&ncm,FALSE);


Author Closing Comment

ID: 38338242
LVL 86

Expert Comment

ID: 38339399
Yes, sorry, a copy&paste accident ;o)

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Starting up a Project

830 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