Pelles C forum

C language => Windows questions => Topic started by: tpekar on July 30, 2013, 05:20:01 PM

Title: Default Window Size
Post by: tpekar on July 30, 2013, 05:20:01 PM
I was wondering if anyone out there knew how Windows determines what size to make the default window.  On my desktop the window is one size, on my laptop a smaller size, and on my netbook even smaller, so small that my controls will not fit on the screen and they overlap the status bar at the bottom.  Any help would be greatly appreciated.

thanks,
--tom
Title: Re: Default Window Size
Post by: Stefan Pendl on July 30, 2013, 09:14:25 PM
If you use a dialog type window, then the controls are placed in dialog base units and not in pixels.

The difference is due to the different DPI settings of the displays.
Title: Re: Default Window Size
Post by: tpekar on July 30, 2013, 10:02:56 PM
Is DPI something that can be accessed within a Pelles C program?  So that adjustments can be made?
Title: Re: Default Window Size
Post by: Stefan Pendl on July 30, 2013, 10:31:07 PM
You would use the GetDeviceCaps API function with the LOGPIXELSX index to retrieve the current DPI settings for the display.

Dividing them by 96 (= 100%) would give you the scaling factor.

You would need the following additional API functions:

MSDN (http://msdn.microsoft.com/en-us/library/default.aspx) has all the information on how to use the API functions.