Jump to content

Recommended Posts

Posted
56 minutes ago, argumentum said:

Same, no WorkerW :(

I don't have it under Program Manager either. In the main window, sort them by class and go down to WorkerW to see if you have it
Me with the Win10 22H2 i have 21 WorkerW

I know that I know nothing

Posted (edited)
1 hour ago, argumentum said:

and Win11 24H2.

..am running 10 PCs, mostly in RDP, and in some it works but in some it doesn't. Any idea of what pre-requisite is needed ? 🤷‍♂️ 

Edit:

...
    If Not $hWorkerW Then
        Local $aChildWindows = _WinAPI_EnumChildWindows($hProgman)
        ;_ArrayDisplay($aChildWindows, '_WinAPI_EnumChildWindows')
        For $n = 1 To UBound($aChildWindows) -1
            If $aChildWindows[$n][1] = "WorkerW" Then $hWorkerW = $aChildWindows[$n][0]
        Next
    EndIf
...

This way works. When WinList() didn't find it, _WinAPI_EnumChildWindows() did.

Edit #2

...
    If Not $hWorkerW Then
        ConsoleWrite(@CRLF)
        Local $aEnumWindows = _WinAPI_EnumWindows(False)
        For $n = 1 To UBound($aEnumWindows) -1
            If $aEnumWindows[$n][1] <> "WorkerW" Then ContinueLoop
            ConsoleWrite('>' & _WinAPI_GetClassName(_WinAPI_GetParent($aEnumWindows[$n][0])) & '<' & @CRLF) ; >Progman<
            If _WinAPI_GetParent($aEnumWindows[$n][0]) = $hProgman Then
                $hWorkerW = $aEnumWindows[$n][0]
                ConsoleWrite('- ' & $aEnumWindows[$n][0] & @TAB & '>' & $aEnumWindows[$n][1] & '<' & @CRLF)
            EndIf
        Next
        ConsoleWrite(@CRLF)
    EndIf
...

This seems to work better than any other 🤷‍♂️

Edited by argumentum
better

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted (edited)

I can only test on my Notebook with Win11 24H2 and the solution was to set parent to the WorkerW handle under Progman. 

I found also the information after midnight to force WorkerW under Progman using 

DllCall("user32.dll", "lresult", "SendMessage","hwnd", $hProgman, "uint",  0x052C, "wparam", 0, "lparam", 0)

but I was too sleepy to continue.

;Code by UEZ build 2025-07-18 beta
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
;~ #include <WinAPIGdi.au3>
;~ #include <Array.au3>

Global $aPrimary = GetPrimaryMonitorCoords()
If @error Then Exit MsgBox(16, "Error", "Unable to get primary monitor")
Global $hProgman = WinGetHandle("[CLASS:Progman]"), $hWorkerW, $i
If Not $hProgman Then Exit MsgBox(16, "ERROR", "Couldn't find Progman", 30)
_WinAPI_SendMessageTimeout($hProgman, 0x052C, 0, 0, 250, $SMTO_NORMAL)

;~ DllCall("user32.dll", "lresult", "SendMessage","hwnd", $hProgman, "uint",  0x052C, "wparam", 0, "lparam", 0)
;~ Sleep(250)

;~ $i = 1
;~ While True
;~  $h = WinGetHandle("[CLASS:WorkerW;INSTANCE:" & $i & "]")
;~  $hWorkerW = _WinAPI_FindWindowEx($hProgman, $h, "WorkerW")
;~  If $hWorkerW Then ExitLoop
;~  $i += 1
;~  If $i = 100 Then Exit MsgBox(16, "ERROR", "Couldn't find WorkerW under Progman", 30)
;~ WEnd

Global $hWorkerW = _WinAPI_FindWindowEx($hProgman, 0, "WorkerW", "")
If $hWorkerW = 0 Then Exit MsgBox(16, "ERROR", "Couldn't find WorkerW under Progman", 30)

Local $aOrigin = GetDesktopOrigin()
Local $iX = $aPrimary[0] - $aOrigin[0]
Local $iY = $aPrimary[1] - $aOrigin[1]

Global $hGUI = GUICreate("GUI behind Desktop icons", $aPrimary[4], $aPrimary[5], $iX, $iY, $WS_POPUP, $WS_EX_TOOLWINDOW)

GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\Examples\GUI\msoobe.jpg", 0, 0, $aPrimary[4], $aPrimary[5])

_WinAPI_SetParent($hGUI, $hWorkerW)
_WinAPI_SetWindowPos($hGUI, $HWND_BOTTOM, 0, 0, 0, 0, BitOR($SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE))
_WinAPI_SetWindowLong($hGUI, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($hGUI, $GWL_EXSTYLE), $WS_EX_LAYERED, $WS_EX_TRANSPARENT))
_WinAPI_SetLayeredWindowAttributes($hGUI, 0, 220, $LWA_ALPHA)

GUISetState(@SW_SHOWNOACTIVATE, $hGUI)

While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd

Func _WinAPI_FindWindowEx($hParent, $hAfter, $sClass, $sTitle = "")
    Local $ret = DllCall("user32.dll", "hwnd", "FindWindowExW", "hwnd", $hParent, "hwnd", $hAfter, "wstr", $sClass, "wstr", $sTitle)
    If @error Or Not IsArray($ret) Then Return 0
    Return $ret[0]
EndFunc   ;==>_WinAPI_FindWindowEx

Func GetPrimaryMonitorCoords()
    Local $tPoint = DllStructCreate("int x;int y")
    $tPoint.x = 0
    $tPoint.y = 0

    Local $hMonitor = _WinAPI_MonitorFromPoint($tPoint, $MONITOR_DEFAULTTOPRIMARY)
    If Not $hMonitor Then Return SetError(1, 0, 0)

    Local $tMI = DllStructCreate("dword cbSize;long rcMonitor[4];long rcWork[4];dword dwFlags")
    DllStructSetData($tMI, "cbSize", DllStructGetSize($tMI))

    Local $aCall = DllCall("user32.dll", "bool", "GetMonitorInfoW", "handle", $hMonitor, "ptr", DllStructGetPtr($tMI))
    If @error Or Not $aCall[0] Then Return SetError(2, 0, 0)

    Local $iLeft = $tMI.rcMonitor(1)
    Local $iTop = $tMI.rcMonitor(2)
    Local $iRight = $tMI.rcMonitor(3)
    Local $iBottom = $tMI.rcMonitor(4)

    Local $iWidth = $iRight - $iLeft
    Local $iHeight = $iBottom - $iTop
    Local $a[6] = [$iLeft, $iTop, $iRight, $iBottom, $iWidth, $iHeight]
    Return $a
EndFunc   ;==>GetPrimaryMonitorCoords

Func GetDesktopOrigin()
    Local $minX = 0, $minY = 0, $x, $y
    Local $i = 0, $tDevice, $aRet, $tDevMode, $aED

    While True
        $tDevice = DllStructCreate("dword cb; char DeviceName[32]; char DeviceString[128]; dword StateFlags; char DeviceID[128]; char DeviceKey[128]")
        $tDevice.cb = DllStructGetSize($tDevice)
        $aRet = DllCall("user32.dll", "bool", "EnumDisplayDevicesA", "ptr", 0, "dword", $i, "ptr", DllStructGetPtr($tDevice), "dword", 0)
        If @error Or Not $aRet[0] Then ExitLoop

        If BitAND($tDevice.StateFlags, 1) Then
            $tDevMode = DllStructCreate( _
                    "byte dmDeviceName[32]; word dmSpecVersion; word dmDriverVersion; word dmSize; word dmDriverExtra; dword dmFields;" & _
                    "long dmPositionX; long dmPositionY; dword dmDisplayOrientation; dword dmDisplayFixedOutput;" & _
                    "short dmColor; short dmDuplex; short dmYResolution; short dmTTOption; short dmCollate; char dmFormName[32];" & _
                    "ushort dmLogPixels; dword dmBitsPerPel; dword dmPelsWidth; dword dmPelsHeight;" & _
                    "dword dmDisplayFlags; dword dmDisplayFrequency; dword dmICMMethod; dword dmICMIntent;" & _
                    "dword dmMediaType; dword dmDitherType; dword dmReserved1; dword dmReserved2; dword dmPanningWidth; dword dmPanningHeight")

            $tDevMode.dmSize = DllStructGetSize($tDevMode)
            $aED = DllCall("user32.dll", "bool", "EnumDisplaySettingsA", "str", $tDevice.DeviceName, "dword", -1, "ptr", DllStructGetPtr($tDevMode))
            If Not @error And $aED[0] Then
                $x = $tDevMode.dmPositionX
                $y = $tDevMode.dmPositionY
                If $x < $minX Then $minX = $x
                If $y < $minY Then $minY = $y
            EndIf
        EndIf
        $i += 1
    WEnd
    Local $a[2] = [$minX, $minY]
    Return $a
EndFunc   ;==>GetDesktopOrigin

 

Edited by UEZ
Should support multi monitor environment now

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted (edited)

When Superman comes in. 🤩🥰

Hello and welcome UEZ, you unlocked the problem as always.

Edited by Parsix
Posted

... Fun topic ... 🙂
just for fun, here are some tweaks to @argumentum's script above to simulate dragging the window and see the visual effect of the movement under the icons...nice effect.

To make the window follow the mouse, press F9 once; to stop the movement, press F9 again.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Version=Beta
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <WinAPISysWin.au3>

Opt("MustDeclareVars", True)

HotKeySet("{ESC}", Terminate) ;;; https://www.autoitscript.com/forum/topic/212981-move-window-behind-desktop-icons/page/2/#findComment-1544435
HotKeySet('{F9}', F9) ; <--
Global $bFlag = False  ; <--
Example()
Func Example()
    Local $hWorkerW = 0, $hProgman = _WinAPI_GetShellWindow() ; WinGetHandle("[CLASS:Progman]")
;~  _SendMessage($hProgman, 0x052C) ; <<<<<< force the creation of a WorkerW handle under Progman

    ; https://stackoverflow.com/questions/56132584/draw-on-windows-10-wallpaper-in-c
    ; https://stackoverflow.com/questions/34952967/drawing-to-the-desktop-via-injection
    ; https://github.com/rocksdanister/lively/issues/2074
    _WinAPI_SendMessageTimeout($hProgman, 0x052C, 0, 0, 3000, $SMTO_NORMAL) ; same as _SendMessage()

    If Not $hWorkerW Then ; dah
        Local $aEnumWindows = _WinAPI_EnumWindows(False)
        For $n = 1 To UBound($aEnumWindows) - 1
            If $aEnumWindows[$n][1] <> "WorkerW" Then ContinueLoop
            If _WinAPI_GetParent($aEnumWindows[$n][0]) = $hProgman Then
                $hWorkerW = $aEnumWindows[$n][0]
                ExitLoop ; but is likely one at the end of the Z-order
            EndIf
        Next
    EndIf

    ConsoleWrite("WorkerW = " & $hWorkerW & @CRLF)
    If Not $hWorkerW Then $hWorkerW = $hProgman

    Local $hGUI = GUICreate("Overlay", 400, 300, 10, 10) ; , $WS_POPUP, $WS_EX_TOOLWINDOW)
    GUICtrlCreatePic(StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1)) & "Examples\GUI\msoobe.jpg", 0, 0, 400, 300)

    _WinAPI_SetParent($hGUI, $hWorkerW)
    _WinAPI_SetWindowLong($hGUI, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($hGUI, $GWL_EXSTYLE), $WS_EX_LAYERED))
    _WinAPI_SetLayeredWindowAttributes($hGUI, 0, 180)

    GUISetState(@SW_SHOWNOACTIVATE)


    While GUIGetMsg() <> $GUI_EVENT_CLOSE
        If $bFlag Then
            WinMove($hGUI,'',MouseGetPos(0),MouseGetPos(1))
        EndIf

    WEnd
EndFunc   ;==>Example

Func Terminate()
    Exit
EndFunc   ;==>Terminate

Func F9()
     $bFlag = Not $bFlag
EndFunc

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted (edited)

 

33 minutes ago, argumentum said:

Oh, is not "mine", is basically @Nine's.
It works most everywhere, almost !. But I only have so much time and know how. But the more people get involved, the better for this script. Thanks for the tweak :) 

 

I set a good challenge, it's giving good results I told @UEZ to come, he comes in like Superman 🤣

Edited by Parsix
Posted (edited)

Added an example how to play a webp animation on the desktop background behind the icons -> WebP

See WebP Example14.au3. You need beside the appropriate _WebP_x??.dll also "Rostislav Uzunov Animation 480x270@30FPS.webp".

Exit of the script only from the taskbar yet.

It is very CPU intensive.

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

  • 2 months later...
Posted (edited)

I remember following this thread with great interest and curiosity. But at the time, I just did not have any project that could use it. So I did not dig too deep into it.

On 7/15/2025 at 10:28 PM, Nine said:

Hey, got it working on Win10.  Never expected it.  Found some code about forcing the creation of a WorkerW handle.  Let's see if it does the job for your too.

This one finds WorkerW and seems to work. However, the window is drawn over top of the desktop icons and not under the icons.

Screenshot:

image.png.8629bf55dbd9f3e97c4f76eaa7316450.png

 

On 7/16/2025 at 4:12 AM, argumentum said:

My take on the problem is creating "WorkerW". Finding it with _WinAPI_EnumWindows() works best.

This one also works, but similar to the screenshot above, it also goes over the icons and not under.

 

On 7/16/2025 at 2:51 AM, UEZ said:

I found also the information after midnight to force WorkerW under Progman using 

I was especially curious about this one because it makes a fullscreen GUI. I really wanted to play around with this one. But I get the "Couldn't find WorkerW under Progman" error no matter what. I even uncommented the section that relates to forcing WorkerW under Progman and I still get the error.

I will mess around with all of these examples some more for the next few hours and see if I can make something happen.

There are close to 20 WorkerW windows under explorer.exe, so I assume it has something to do with Z-order.

EDIT: I see what is happening now. None of the scripts are able to get a handle for WorkerW for some reason.

EDIT2: It appears that none of the WorkerW windows are actually going under Progman. Not only that, but it seems that the force creation of a WorkerW window seems to be failing.

Edited by WildByDesign
Posted
3 hours ago, WildByDesign said:

I remember following this thread with great interest and curiosity. But at the time, I just did not have any project that could use it.

So..., what changed ?, what are you up to ? ( no good I'd guess :P )
What's been done in the past is to get the background image and add whatever it wants to be shown to it and set that edited image as the background image. That should work from Windows v.whatever until the holographic monitors comes out 🤔

So..., what are you up to ?

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted
6 hours ago, argumentum said:

( no good I'd guess :P )

Always no good, 100%. :)

I am just weirdly curious about doing a desktop sized GUI like this, below the desktop icons but just above the wallpaper, and experiment with adding blur to it to blur the wallpaper or possibly shades of colors.

I might end up reinstalling Windows though because nothing seems to be able to successfully create a WorkerW window under Progman on my system. I even tried a few C++ programs that do some neat things that also involve creating a WorkerW under Progman and they fail too on my system. It's an up-to-date 24H2 Win11 Pro but for whatever reason this consistently fails for me.

Posted

I was so grouchy at the thought of blasting away my Windows partition to reinstall Windows but thankfully I figured it out before I got that far.

In Advanced System Properties (SystemPropertiesAdvanced.exe) in the Performance settings dialog - Visual Effects tab, there is a checkbox labelled "Animate controls and element inside windows".

Apparently that simple little checkbox controls whether or not a WorkerW window is even allowed to be created under Progman. I have always disabled any and all animation effects in Windows for years. And this was one of them. After checking this box, WorkerW is able to be created under Progman and all is good now. All examples work on my machine now. :)

I would have reinstalled Windows and it still would have failed because disabling animation effects is one of the first things that I do after a clean install. 😄

Posted

Here is an example, built on top of @UEZ's example, that fills the entire desktop with a tiled image. It's just using a built-in AutoIt image for the sake of this example. But my plan is to use a blurred tile that would act as a way to blur the wallpaper with various texture(s). Thanks to @InnI for helping me with the tiling image.

 

;Code by UEZ build 2025-07-18 beta
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPIGdi.au3>
#include <Array.au3>

#include <GDIPlus.au3>

DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", "DPI_AWARENESS_CONTEXT" -4)

Global $aPrimary = GetPrimaryMonitorCoords()
If @error Then Exit MsgBox(16, "Error", "Unable to get primary monitor")
Global $hProgman = WinGetHandle("[CLASS:Progman]"), $hWorkerW, $i
If Not $hProgman Then Exit MsgBox(16, "ERROR", "Couldn't find Progman", 30)
_WinAPI_SendMessageTimeout($hProgman, 0x052C, 0, 0, 250, $SMTO_NORMAL)


_GDIPlus_Startup()
Local $sFile = "C:\Program Files (x86)\AutoIt3\Examples\GUI\logo4.gif"
Local $hImage = _GDIPlus_ImageLoadFromFile($sFile) ;create an image object based on a file

Global $hWorkerW = _WinAPI_FindWindowEx($hProgman, 0, "WorkerW", "")
If $hWorkerW = 0 Then Exit MsgBox(16, "ERROR", "Couldn't find WorkerW under Progman", 30)

Local $aOrigin = GetDesktopOrigin()
Local $iX = $aPrimary[0] - $aOrigin[0]
Local $iY = $aPrimary[1] - $aOrigin[1]

Global $hGUI = GUICreate("GUI behind Desktop icons", $aPrimary[4], $aPrimary[5], $iX, $iY, $WS_POPUP, $WS_EX_TOOLWINDOW)

_WinAPI_SetParent($hGUI, $hWorkerW)
_WinAPI_SetWindowPos($hGUI, $HWND_BOTTOM, 0, 0, 0, 0, BitOR($SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE))
_WinAPI_SetWindowLong($hGUI, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($hGUI, $GWL_EXSTYLE), $WS_EX_LAYERED, $WS_EX_TRANSPARENT))
_WinAPI_SetLayeredWindowAttributes($hGUI, 0, 120, $LWA_ALPHA)

GUISetState(@SW_SHOWNOACTIVATE, $hGUI)

Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;create a Graphics object from a window handle
_GDIPlus_GraphicsClear($hGraphics, 0xFF000000) ;clear graphic handle with dark grey (background)
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;sets the graphics object rendering quality (antialiasing)
Local $hTexture = _GDIPlus_TextureCreate2($hImage, 5, 4, 59, 59) ;create texture brush only from a defined rectangle
_GDIPlus_GraphicsFillRect($hGraphics, 0, 0, $aPrimary[4], $aPrimary[5], $hTexture)

While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd

;cleanup resources
_GDIPlus_BrushDispose($hTexture)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
GUIDelete($hGUI)


Func _WinAPI_FindWindowEx($hParent, $hAfter, $sClass, $sTitle = "")
    Local $ret = DllCall("user32.dll", "hwnd", "FindWindowExW", "hwnd", $hParent, "hwnd", $hAfter, "wstr", $sClass, "wstr", $sTitle)
    If @error Or Not IsArray($ret) Then Return 0
    Return $ret[0]
EndFunc   ;==>_WinAPI_FindWindowEx

Func GetPrimaryMonitorCoords()
    Local $tPoint = DllStructCreate("int x;int y")
    $tPoint.x = 0
    $tPoint.y = 0

    Local $hMonitor = _WinAPI_MonitorFromPoint($tPoint, $MONITOR_DEFAULTTOPRIMARY)
    If Not $hMonitor Then Return SetError(1, 0, 0)

    Local $tMI = DllStructCreate("dword cbSize;long rcMonitor[4];long rcWork[4];dword dwFlags")
    DllStructSetData($tMI, "cbSize", DllStructGetSize($tMI))

    Local $aCall = DllCall("user32.dll", "bool", "GetMonitorInfoW", "handle", $hMonitor, "ptr", DllStructGetPtr($tMI))
    If @error Or Not $aCall[0] Then Return SetError(2, 0, 0)

    Local $iLeft = $tMI.rcMonitor(1)
    Local $iTop = $tMI.rcMonitor(2)
    Local $iRight = $tMI.rcMonitor(3)
    Local $iBottom = $tMI.rcMonitor(4)

    Local $iWidth = $iRight - $iLeft
    Local $iHeight = $iBottom - $iTop
    Local $a[6] = [$iLeft, $iTop, $iRight, $iBottom, $iWidth, $iHeight]
    Return $a
EndFunc   ;==>GetPrimaryMonitorCoords

Func GetDesktopOrigin()
    Local $minX = 0, $minY = 0, $x, $y
    Local $i = 0, $tDevice, $aRet, $tDevMode, $aED

    While True
        $tDevice = DllStructCreate("dword cb; char DeviceName[32]; char DeviceString[128]; dword StateFlags; char DeviceID[128]; char DeviceKey[128]")
        $tDevice.cb = DllStructGetSize($tDevice)
        $aRet = DllCall("user32.dll", "bool", "EnumDisplayDevicesA", "ptr", 0, "dword", $i, "ptr", DllStructGetPtr($tDevice), "dword", 0)
        If @error Or Not $aRet[0] Then ExitLoop

        If BitAND($tDevice.StateFlags, 1) Then
            $tDevMode = DllStructCreate( _
                    "byte dmDeviceName[32]; word dmSpecVersion; word dmDriverVersion; word dmSize; word dmDriverExtra; dword dmFields;" & _
                    "long dmPositionX; long dmPositionY; dword dmDisplayOrientation; dword dmDisplayFixedOutput;" & _
                    "short dmColor; short dmDuplex; short dmYResolution; short dmTTOption; short dmCollate; char dmFormName[32];" & _
                    "ushort dmLogPixels; dword dmBitsPerPel; dword dmPelsWidth; dword dmPelsHeight;" & _
                    "dword dmDisplayFlags; dword dmDisplayFrequency; dword dmICMMethod; dword dmICMIntent;" & _
                    "dword dmMediaType; dword dmDitherType; dword dmReserved1; dword dmReserved2; dword dmPanningWidth; dword dmPanningHeight")

            $tDevMode.dmSize = DllStructGetSize($tDevMode)
            $aED = DllCall("user32.dll", "bool", "EnumDisplaySettingsA", "str", $tDevice.DeviceName, "dword", -1, "ptr", DllStructGetPtr($tDevMode))
            If Not @error And $aED[0] Then
                $x = $tDevMode.dmPositionX
                $y = $tDevMode.dmPositionY
                If $x < $minX Then $minX = $x
                If $y < $minY Then $minY = $y
            EndIf
        EndIf
        $i += 1
    WEnd
    Local $a[2] = [$minX, $minY]
    Return $a
EndFunc   ;==>GetDesktopOrigin

 

Posted (edited)
3 hours ago, WildByDesign said:

But my plan is to...

...
Local $sFile = StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1) -1 ) & "\Examples\GUI\logo4.gif"
Local $hImage = _GDIPlus_ImageLoadFromFile($sFile) ;create an image object based on a file

Global $hWorkerW = _WinAPI_FindWindowEx($hProgman, 0, "WorkerW", "")

If Not $hWorkerW Then ; dah
    Local $aEnumWindows = _WinAPI_EnumWindows(False)
    For $n = 1 To UBound($aEnumWindows) - 1
        If $aEnumWindows[$n][1] <> "WorkerW" Then ContinueLoop
        If _WinAPI_GetParent($aEnumWindows[$n][0]) = $hProgman Then
            $hWorkerW = $aEnumWindows[$n][0]
            ExitLoop ; but is likely one at the end of the Z-order
        EndIf
    Next
EndIf

If $hWorkerW = 0 Then Exit MsgBox(16, "ERROR", "Couldn't find WorkerW under Progman", 30)
...
OnAutoItExitRegister(CleanupResources)

While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd

CleanupResources()
Func CleanupResources()
    Local Static $iRunOnce = 0
    If $iRunOnce Then Return
    ConsoleWrite('+ Func CleanupResources() -  WinExists: ' & WinExists($hGUI) & ' - ' & (IsInt(Execute("@exitCode")) ? 'TrayExit' : 'GuiClosed') & @CRLF)
    ;cleanup resources
    _GDIPlus_BrushDispose($hTexture)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    GUIDelete($hGUI)
    $iRunOnce = 1
EndFunc
...

...be mindful of everyone and everything  ?  :)

Edited by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted

to test different patterns simultaneously

; https://www.autoitscript.com/forum/topic/212981-move-window-behind-desktop-icons/page/2/#findComment-1544444

#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", True)

Example()

Func Example()
    Local $hWorkerW = _GetDesktopWorkerW()
    If @error Then Exit MsgBox(16, @ScriptName, "! Error - Couldn't find WorkerW under Progman", 30)
    ConsoleWrite("WorkerW = " & $hWorkerW & @CRLF)

    ; Overlay GUICreate
    Local $hGUI = GUICreate("Overlay", @DesktopWidth, @DesktopHeight, -1, -1, $WS_POPUP, $WS_EX_TOOLWINDOW)
    Local $BkColor = 0x000000
    GUISetBkColor($BkColor, $hGUI)
    GUISetFont(12)
    _WinAPI_SetParent($hGUI, $hWorkerW)
    _WinAPI_SetWindowLong($hGUI, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($hGUI, $GWL_EXSTYLE), $WS_EX_LAYERED))
    _WinAPI_SetLayeredWindowAttributes($hGUI, 0, 150, $LWA_ALPHA)
    GUISetState(@SW_SHOWNOACTIVATE)

    Local $aChildGui[10] = [9], $aLbl[10] = [9]
    Local $iW = @DesktopWidth * 0.33, $iH = @DesktopHeight * 0.33, $iX = 0, $iY = 20, $iCnt = 0
    For $i = 1 To 3
        For $j = 1 To 3
            $iCnt += 1
            $aChildGui[$iCnt] = GUICreate("Child_" & $iCnt, $iW, $iH, $iX, $iY, $WS_CHILD, $WS_EX_TOOLWINDOW, $hGUI)
            $BkColor = "0x" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2)
            ConsoleWrite("$BkColor=" & $BkColor & @CRLF)
            GUISetBkColor($BkColor, $aChildGui[$iCnt])
            $aLbl[$iCnt] = GUICtrlCreateLabel("Child_" & $iCnt & ", BkColor:" & $BkColor, 0, 0, $iW, 25)
            GUICtrlSetFont(-1, 18)
            GUISetState(@SW_SHOWNOACTIVATE)
            $iX += $iW
        Next
        $iX = 0
        $iY += $iH
    Next


    $iCnt = 0

    While GUIGetMsg() <> $GUI_EVENT_CLOSE
        Sleep(50)
        $iCnt += 1
        If $iCnt > 40 Then
            $iCnt = 0
            For $i = 1  To $aChildGui[0]
                $BkColor = "0x" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2)
                GUISetBkColor($BkColor, $aChildGui[$i])
                GUICtrlSetData($aLbl[$i], "Child_" & $i & ", BkColor:" & $BkColor)
            Next
        EndIf
    WEnd
EndFunc   ;==>Example

Func _GetDesktopWorkerW()
    Local $hWorkerW = 0, $hProgman = _WinAPI_GetShellWindow()
    _WinAPI_SendMessageTimeout($hProgman, 0x052C, 0, 0, 3000, $SMTO_NORMAL) ; same as _SendMessage()
    Local $aEnumWindows = WinList("[CLASS:WorkerW]")
    For $n = 1 To $aEnumWindows[0][0]
        Local $hWnd = $aEnumWindows[$n][1]
        If _WinAPI_GetParent($hWnd) = $hProgman Then Return SetError(0, $hProgman, $hWnd)
    Next
    Return SetError(1, $hProgman, 0)
EndFunc   ;==>_GetDesktopWorkerW

 

I know that I know nothing

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...