FuPeiJiang / VD.ahk

Windows Virtual Desktop, AutoHotkey, Windows 11 support, Windows Server 2022, switch desktop, move window(wintitle) to current desktop; createDesktop, PinWindow, getCount, getDesktopNumOfWindow -> mute all windows in Virtual Desktop
MIT License
348 stars 47 forks source link

Setting a wallpaper #73

Open kuitog opened 1 month ago

kuitog commented 1 month ago

Can't figure out how to set a desktop wallpaper with a solid color. (Or in alternative with an image)

The SetDesktopWallpaper function is not documented.

thanks

kuitog commented 1 month ago

The file was deleted from mediafire @youngerwarrior

FuPeiJiang commented 1 month ago

@kuitog

IDesktopWallpaper:=ComObject("{c2cf3110-460e-4fc1-b9d0-8a1c0c9cc4bd}","{b92b56a9-8b55-4e14-9a89-0199bbb6f93b}")
loop 100 {
    ComCall(8,IDesktopWallpaper,"Uint",Random(0,0x00FFFFFF))
    Sleep 1000
}

this will set a random rgb color every 1000ms

IDesktopWallpaper:=ComObject("{c2cf3110-460e-4fc1-b9d0-8a1c0c9cc4bd}","{b92b56a9-8b55-4e14-9a89-0199bbb6f93b}")
ComCall(3,IDesktopWallpaper,"Ptr",0,"WStr","C:\path\to\wallpaper.jpg") ;monitorID=0 for all monitors

this is for setting a wallpaper(image) on all virtual desktops, and all monitors

#include %A_LineFile%\..\VD.ah2
VD.setWallpaperToDesktopNum("C:\path\to\wallpaper.jpg", 1)

this is for setting a wallpaper(image) to Desktop 1

kuitog commented 1 month ago

@FuPeiJiang Hi! many thanks for the reply! Example 1 is perfect, but I can't figure out how to assign it only to desktop 2

IDesktopWallpaper:=ComObject("{c2cf3110-460e-4fc1-b9d0-8a1c0c9cc4bd}","{b92b56a9-8b55-4e14-9a89-0199bbb6f93b}") loop 100 { ComCall(8,IDesktopWallpaper,"Uint",Random(0,0x00FFFFFF)) Sleep 1000 }

FuPeiJiang commented 1 month ago

@kuitog I don't even know how to do this manually in windows: how to set a different solid color for each virtual desktop a workaround would be to use a .png (that is a solid color) for each virtual desktop

if you want that, I'll try to write a random solid color .png generator in ahk ? it's a very good way to understand the format, imo