Wolfram Research

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

Get the dimensions of the Messages window:

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

Possible Issues

Win32WindowDimensions is only supported on Windows operating systems:

Out[2]=
In[3]:=
$OperatingSystem
Out[3]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

See Also

License Information