Pelles C forum
C language => Windows questions => Topic started 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
-
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.
-
Is DPI something that can be accessed within a Pelles C program? So that adjustments can be made?
-
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:
- GetDC of the zero handle for the entire screen
- ReleaseDC to release the device context
MSDN (http://msdn.microsoft.com/en-us/library/default.aspx) has all the information on how to use the API functions.