Hi all,

I am trying to determine the usable screen size of desktop computers. I
found WMI classes that would return the desktop resolution BUT I need:
[screen height] - [taskbar height] = [usable screen size]
Is there a way to determine if the auto-hide is enabled? Can I determine the
height of the taskbar?

I use the "Win32_DesktopMonitor" WMI class at the moment but this only
returns the set screen resolution.

Any idea on how to do this via WMI or maybe read values out of the registry.
I looked into some TechNet articles but I didn't find anything helpful yet.

Regards,
Hadi

Re: How to get usable screen size (maybe WMI?) by mayayana

mayayana
Mon Jul 18 08:00:26 CDT 2005

It's actually much easier than that. You can use the IE
window screen object:

Dim IE, Scr, s
Set IE = CreateObject("InternetExplorer.Application")
IE.visible = False
IE.Navigate("about:blank")
Do Until IE.ReadyState = 4
Loop

Set Scr = IE.Document.parentWindow.screen

s = "Width: " & Scr.width & vbCrLf
s = s & "Height: " & Scr.height & vbCrLf
s = s & "Available Width: " & Scr.availwidth & vbCrLf
s = s & "Available Height: " & Scr.availheight & vbCrLf
s = s & "Bits Per Pixel: " & Scr.colordepth & vbCrLf

MsgBox s

Set Scr = Nothing
IE.Quit
Set IE = Nothing


--
--
Hadi <Hadi@discussions.microsoft.com> wrote in message
news:C9109935-EDAF-4695-88BD-2321C6BA90ED@microsoft.com...
> Hi all,
>
> I am trying to determine the usable screen size of desktop computers. I
> found WMI classes that would return the desktop resolution BUT I need:
> [screen height] - [taskbar height] = [usable screen size]
> Is there a way to determine if the auto-hide is enabled? Can I determine
the
> height of the taskbar?
>
> I use the "Win32_DesktopMonitor" WMI class at the moment but this only
> returns the set screen resolution.
>
> Any idea on how to do this via WMI or maybe read values out of the
registry.
> I looked into some TechNet articles but I didn't find anything helpful
yet.
>
> Regards,
> Hadi



Re: How to get usable screen size (maybe WMI?) by Hadi

Hadi
Mon Jul 18 09:10:11 CDT 2005

Hi mayayana,

Thank you for your hint. I would like to use this functionality in a login
script and some of our clients are still running on P2.

I found another solution which does not require to start an instance of IE
during logon:

Set objShell = CreateObject("WScript.Shell")
intBinArray =
objShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explore
r\StuckRects2\Settings")
If intBinArray(8) / 2 = Int(intBinArray(8) / 2) Then
bAutoHide = False
Else
bAutoHide = True
End If
intTaskBarWidth = intBinArray(20)

This is I think quicker on slower clients - I just query the registry and
substract the width of the taskbar (if it is not in auto-hide mode) from the
screen resolution

Thank you very much for helping me out with your tip!!

"mayayana" wrote:

> It's actually much easier than that. You can use the IE
> window screen object:
>
> Dim IE, Scr, s
> Set IE = CreateObject("InternetExplorer.Application")
> IE.visible = False
> IE.Navigate("about:blank")
> Do Until IE.ReadyState = 4
> Loop
>
> Set Scr = IE.Document.parentWindow.screen
>
> s = "Width: " & Scr.width & vbCrLf
> s = s & "Height: " & Scr.height & vbCrLf
> s = s & "Available Width: " & Scr.availwidth & vbCrLf
> s = s & "Available Height: " & Scr.availheight & vbCrLf
> s = s & "Bits Per Pixel: " & Scr.colordepth & vbCrLf
>
> MsgBox s
>
> Set Scr = Nothing
> IE.Quit
> Set IE = Nothing
>
>
> --
> --
> Hadi <Hadi@discussions.microsoft.com> wrote in message
> news:C9109935-EDAF-4695-88BD-2321C6BA90ED@microsoft.com...
> > Hi all,
> >
> > I am trying to determine the usable screen size of desktop computers. I
> > found WMI classes that would return the desktop resolution BUT I need:
> > [screen height] - [taskbar height] = [usable screen size]
> > Is there a way to determine if the auto-hide is enabled? Can I determine
> the
> > height of the taskbar?
> >
> > I use the "Win32_DesktopMonitor" WMI class at the moment but this only
> > returns the set screen resolution.
> >
> > Any idea on how to do this via WMI or maybe read values out of the
> registry.
> > I looked into some TechNet articles but I didn't find anything helpful
> yet.
> >
> > Regards,
> > Hadi
>
>
>

Re: How to get usable screen size (maybe WMI?) by mayayana

mayayana
Mon Jul 18 18:38:50 CDT 2005

That's interesting. I've never been aware of that
setting before. On my 98SE machine it's StuckRects,
though. There is no StuckRects2 key.

--
--
Hadi <Hadi@discussions.microsoft.com> wrote in message
news:9C23F94D-61A4-40C7-87CA-9C63D9AD8692@microsoft.com...
> Hi mayayana,
>
> Thank you for your hint. I would like to use this functionality in a login
> script and some of our clients are still running on P2.
>
> I found another solution which does not require to start an instance of IE
> during logon:
>
> Set objShell = CreateObject("WScript.Shell")
> intBinArray =
> objShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explore
> r\StuckRects2\Settings")
> If intBinArray(8) / 2 = Int(intBinArray(8) / 2) Then
> bAutoHide = False
> Else
> bAutoHide = True
> End If
> intTaskBarWidth = intBinArray(20)
>
> This is I think quicker on slower clients - I just query the registry and
> substract the width of the taskbar (if it is not in auto-hide mode) from
the
> screen resolution
>
> Thank you very much for helping me out with your tip!!
>
> "mayayana" wrote:
>
> > It's actually much easier than that. You can use the IE
> > window screen object:
> >
> > Dim IE, Scr, s
> > Set IE = CreateObject("InternetExplorer.Application")
> > IE.visible = False
> > IE.Navigate("about:blank")
> > Do Until IE.ReadyState = 4
> > Loop
> >
> > Set Scr = IE.Document.parentWindow.screen
> >
> > s = "Width: " & Scr.width & vbCrLf
> > s = s & "Height: " & Scr.height & vbCrLf
> > s = s & "Available Width: " & Scr.availwidth & vbCrLf
> > s = s & "Available Height: " & Scr.availheight & vbCrLf
> > s = s & "Bits Per Pixel: " & Scr.colordepth & vbCrLf
> >
> > MsgBox s
> >
> > Set Scr = Nothing
> > IE.Quit
> > Set IE = Nothing
> >
> >
> > --
> > --
> > Hadi <Hadi@discussions.microsoft.com> wrote in message
> > news:C9109935-EDAF-4695-88BD-2321C6BA90ED@microsoft.com...
> > > Hi all,
> > >
> > > I am trying to determine the usable screen size of desktop computers.
I
> > > found WMI classes that would return the desktop resolution BUT I need:
> > > [screen height] - [taskbar height] = [usable screen size]
> > > Is there a way to determine if the auto-hide is enabled? Can I
determine
> > the
> > > height of the taskbar?
> > >
> > > I use the "Win32_DesktopMonitor" WMI class at the moment but this only
> > > returns the set screen resolution.
> > >
> > > Any idea on how to do this via WMI or maybe read values out of the
> > registry.
> > > I looked into some TechNet articles but I didn't find anything helpful
> > yet.
> > >
> > > Regards,
> > > Hadi
> >
> >
> >