Function Repository Resource:

Win32WindowDimensions

Source Notebook

Get the width and height of a window

Contributed by: Daniel Bigham

ResourceFunction["Win32WindowDimensions"][hwnd]

returns the width and height of the window with the given window handle (HWND).

ResourceFunction["Win32WindowDimensions"][func]

returns the width and height of the window for which the given function returns True when passed the window’s title.

Details and Options

ResourceFunction["Win32WindowDimensions"] is only supported on Windows machines.
If multiple windows match the given criteria, dimensions for the first of these are returned.
If no window matches the given criteria, a Failure object is returned.

Examples

Basic Examples (1) 

Get the dimensions of the Messages window:

In[1]:=
ResourceFunction["Win32WindowDimensions"][
 StringStartsQ["Messages - "]]
Out[1]=

Possible Issues (1) 

Win32WindowDimensions is only supported on Windows operating systems:

In[2]:=
ResourceFunction["Win32WindowDimensions"][]
Out[2]=
In[3]:=
$OperatingSystem
Out[3]=

Publisher

Daniel Bigham

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.0.0 – 19 March 2019

Related Resources

License Information