Windows 11 moving wallpaper

FortranGuy
Sat, 27 Sep 2025 08:33:45 +0000
Gallery

Hello everyone!

As a hobby, I create static wallpapers by overlaying green rectangle with anime characters.

One day, I came across an illustration of a pocket watch, so instead of overlaying it with a green rectangle, I implemented a watch movement using Processing to create a moving wallpaper.

Surprisingly, the code for the moving wallpaper turned out to be shorter than I expected.

import com.sun.jna.Native;
import com.sun.jna.Structure;
import com.sun.jna.WString;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.WinDef.HWND;
import com.sun.jna.platform.win32.WinDef.DWORDByReference;
import com.sun.jna.platform.win32.WinDef.WPARAM;
import com.sun.jna.platform.win32.WinDef.LPARAM;
import com.sun.jna.platform.win32.WinDef.HDC;
import com.sun.jna.platform.win32.* ;
import com.sun.jna.win32.StdCallLibrary;

HWND workerW ;
HWND childDC ;
HDC dc_workerW ;
HDC dc_childDC ;

[…]

void setup() {

fullScreen(1);
frameRate(60);

[...]

HWND progman = User32.INSTANCE.FindWindow ( “Progman”, null ) ;
DWORDByReference dbr = new DWORDByReference();
User32.INSTANCE.SendMessageTimeout ( progman, 0x052c, new WPARAM(0), new
LPARAM(0), 0x0, 1000, dbr ) ;

HWND workerW = User32.INSTANCE.FindWindowEx ( progman, null, “workerW”,
null) ;
HDC dc_workerW = User32.INSTANCE.GetDC( workerW );

HWND childDC = User32.INSTANCE.FindWindow ( null, “[sketch_name]” ) ;
HDC dc_childDC = User32.INSTANCE.GetDC( childDC );

HWND rtn_set = User32.INSTANCE.SetParent ( childDC, workerW ) ;

}

That’s all the code you need to add to sketch.

ex; Pocket watch

x.com

@

ex; Video playback

x.com

@

See you again sometime.

5 posts - 2 participants