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)

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.

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

Opt("MustDeclareVars", True)

HotKeySet("{ESC}", Terminate)

Example()

Func Example()
  Local $hProgman = WinGetHandle("[CLASS:Progman]")
  _SendMessage($hProgman, 0x052c)  ; <<<<<< force the creation of a WorkerW handle under Progman

  Local $aList = WinList(), $hWorkerW

  For $i = 1 To $aList[0][0]
    If _WinAPI_GetParent($aList[$i][1]) = $hProgman And _WinAPI_GetClassName($aList[$i][1]) = "WorkerW" Then
      $hWorkerW = $aList[$i][1]
      ExitLoop
    EndIf
  Next

  ConsoleWrite("WorkerW " & $hWorkerW & @CRLF)

  Local $hGUI = GUICreate("Overlay", 400, 300, 10, 10, $WS_POPUP, $WS_EX_TOOLWINDOW)
  GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\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 Sleep(100)
  WEnd
EndFunc   ;==>Example

Func Terminate()
  Exit
EndFunc   ;==>Terminate

 

Edited by Nine
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-16 beta
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


Global $hProgman = WinGetHandle("[CLASS:Progman]"), $hWorkerW, $i
If Not $hProgman Then Exit MsgBox(16, "ERROR", "Couldn't find Progman", 30)
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)

Global $SWP = BitOR($SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE)

$hGUI = GUICreate("Overlay", 400, 300, 10, 10, $WS_POPUP, $WS_EX_TOOLWINDOW)

GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\Examples\GUI\msoobe.jpg", 0, 0, 400, 300)

_WinAPI_SetParent($hGUI, $hWorkerW)
_WinAPI_SetWindowPos($hGUI, $HWND_BOTTOM, 0, 0, 0, 0, $SWP)
_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

 

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted
#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

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
    WEnd
EndFunc   ;==>Example

Func Terminate()
    Exit
EndFunc   ;==>Terminate

My take on the problem is creating "WorkerW". Finding it with _WinAPI_EnumWindows() works best.
Reading this github.com/rocksdanister/lively/issues/2074 ( and  the projects ) look interesting. 

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

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
Just now, Gianni said:

just for fun, here are some tweaks to @argumentum's script

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 :) 

 

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

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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...