Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get desktop screen size

667 views
Skip to first unread message

Vijay Kulkarni

unread,
Nov 12, 1997, 3:00:00 AM11/12/97
to

Mark Williams wrote:
>
> How do you get the desktop screen size? I want to display a window which
> fills the whole screen.
>
> I have tryed GetSystemMetrics(SM_C[X/Y]FULLSCREEN). The function seems
> to return the correct width but the height is always 19 pixels short
> of the screen size.


SM_CYFULLSCREEN gives full screen client size, add caption height.

screen_height = GetSystemMetrics(SM_CYFULLSCREEN)
+ GetSystemMetrics(SM_CYCAPTION);

Vijay Kulkarni

unread,
Nov 12, 1997, 3:00:00 AM11/12/97
to

Mark Williams wrote:
>
> How do you get the desktop screen size? I want to display a window which
> fills the whole screen.
>
> I have tryed GetSystemMetrics(SM_C[X/Y]FULLSCREEN). The function seems
> to return the correct width but the height is always 19 pixels short
> of the screen size.
>
> TIA
>
> --
> | Mark Williams, Tech OP Ltd | Have a look at our web pages
> | Principal Engineer | for consultancy and some free software ...
> | email: mark(at)techop.co.uk---- | http://www.techop.demon.co.uk/
> | [Replace the (at) with @ and remove the -'s to mail me]

Mark Williams

unread,
Nov 12, 1997, 3:00:00 AM11/12/97
to

Valter Minute

unread,
Nov 13, 1997, 3:00:00 AM11/13/97
to

Mark Williams wrote in message <64cm0a$2...@holly.demon.co.uk>...


>How do you get the desktop screen size? I want to display a window which
>fills the whole screen.
>
>I have tryed GetSystemMetrics(SM_C[X/Y]FULLSCREEN). The function seems
>to return the correct width but the height is always 19 pixels short
>of the screen size.
>


GetSystemMetrics returns the size of a maximized windows, so it removes from
the total height of the window the size of the system tray.
To get the screen size you have to get a DC for the entire screen surface
(GetWindowDC(NULL)) and the use GetDeviceCaps(dc,HORZRES) and
GetDeviceCaps(dc,VERTRES) to retrieve screen size.

Valter Minute
min...@fortech.it
www.fortech.it

William Slease

unread,
Nov 13, 1997, 3:00:00 AM11/13/97
to

Excerpts from netnews.comp.os.ms-windows.programmer.win32: 12-Nov-97 How
to get desktop screen size by Mark Will...@no.such.ho
> How do you get the desktop screen size? I want to display a window which
> fills the whole screen.
>
> I have tryed GetSystemMetrics(SM_C[X/Y]FULLSCREEN). The function seems
> to return the correct width but the height is always 19 pixels short
> of the screen size.

try SM_C[X/Y]SCREEN instead of FULLSCREEN. Those work for me.
FULLSCREEN is maybe occluding the space for the taskbar?

Bill

Joachim Feise

unread,
Nov 13, 1997, 3:00:00 AM11/13/97
to

Valter Minute wrote:
>
> Mark Williams wrote in message <64cm0a$2...@holly.demon.co.uk>...
> >How do you get the desktop screen size? I want to display a window which
> >fills the whole screen.
> >
> >I have tryed GetSystemMetrics(SM_C[X/Y]FULLSCREEN). The function seems
> >to return the correct width but the height is always 19 pixels short
> >of the screen size.
> >
>
> GetSystemMetrics returns the size of a maximized windows, so it removes from
> the total height of the window the size of the system tray.
> To get the screen size you have to get a DC for the entire screen surface
> (GetWindowDC(NULL)) and the use GetDeviceCaps(dc,HORZRES) and
> GetDeviceCaps(dc,VERTRES) to retrieve screen size.
Not true. GetSystemMetrics(SM_C{X|Y}SCREEN) returns the screen size.
If you want the size without the taskbar, use
SystemParametersInfo( SPI_GETWORKAREA, 0, &rect, 0 )

Joe
--
Joachim Feise Microsoft Certified Solutions Developer
mailto:jfe...@acm.org http://www.ics.uci.edu/~jfeise/
mailto:jfe...@ics.uci.edu mailto:jfe...@ecs.com
---------------------------------------------------------------------
By US Code Title 47, Sec.227(a)(2)(B), a computer/modem/printer meets
the definition of a telephone fax machine. By Sec.227(b)(1)(C), it is
unlawful to send any unsolicited advertisement to such equipment.
By Sec.227(b)(3)(C), a violation of the aforementioned section is
punishable by action to recover actual monetary loss, or $500,
whichever is greater, for each violation.

Mark Williams

unread,
Nov 17, 1997, 3:00:00 AM11/17/97
to

In article <AoOlDI_00...@andrew.cmu.edu>,

William Slease <sle...@andrew.cmu.edu> wrote:
>
>try SM_C[X/Y]SCREEN instead of FULLSCREEN. Those work for me.
>FULLSCREEN is maybe occluding the space for the taskbar?
>

Thanks for all the replies - This one works for me!

Regards,

0 new messages