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 (2) 

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 (1) 

Win32Windows is only supported on Windows operating systems:

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

Publisher

Daniel Bigham

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 2.0.0 – 07 March 2019
  • 1.0.0 – 27 February 2019

License Information