Wolfram Research

Function Repository Resource:

Win32Windows

Source Notebook

Return the Window handles (HWNDs) of all windows

Contributed by: Daniel Bigham

ResourceFunction["Win32Windows"][]

returns the Window handles (HWNDs) of all windows.

Details and Options

ResourceFunction["Win32Windows"] is only supported on Windows machines.

Examples

Basic Examples

Get all window handles:

In[1]:=
ResourceFunction["Win32Windows"][] // Short
Out[1]=

Check how many windows are minimized:

In[2]:=
<< NETLink`
IsIconic = DefineDLLFunction["IsIconic", "user32.dll", "BOOL", {"HWND"}];
Counts[
 Function[{hwnd},
   hwndPointer = NETNew["System.IntPtr", hwnd];
   res = IsIconic[hwndPointer];
   ReleaseNETObject[hwndPointer];
   Replace[res, {0 -> False, 1 -> True}]
   ] /@ ResourceFunction["Win32Windows"][]
 ]
Out[4]=

Possible Issues

Win32Windows is only supported on Windows operating systems:

In[5]:=
ResourceFunction["Win32Windows"][]
Out[5]=
In[6]:=
$OperatingSystem
Out[6]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

License Information