Jump to content

Recommended Posts

Posted
#include-once
#include <GDIPlus.au3>
#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <StructureConstants.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include <ColorConstants.au3>
#include <StaticConstants.au3>
#include <WinAPIConstants.au3>
#include <WinAPIGdi.au3>
#include <WinAPIProc.au3>
#include <WinAPISys.au3>
#include <WinAPISysWin.au3>



#include <WinApi.au3>

Main()

Func Main()
    Local $this = GUICreate("", 400, 400, @DesktopWidth-(400)-20, 100, $WS_POPUP , $WS_EX_NOACTIVATE + $WS_EX_TRANSPARENT)
    Local $iPic = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\Examples\GUI\msoobe.jpg",0, 0, 400, 400)
    ;GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

    WinSetTrans($this,"", 200)
    _GuiRoundCorners($this, 16, 16)

    _WinAPI_SetWindowLong($this, $GWL_HWNDPARENT, ControlGetHandle("[CLASS:Progman]", "", "SysListView321")) ;hide in taskbar

    GUISetState(@SW_SHOWNOACTIVATE, $this)
    ;_WinAPI_SetWindowPos($this, $HWND_BOTTOM, Default, Default, Default, Default, BitOR($SWP_NOACTIVATE, $SWP_SHOWWINDOW, $SWP_NOMOVE, $SWP_NOSIZE )) ;not worked

    While 1
      Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
      EndSwitch
    WEnd
    GUIDelete($this)
EndFunc ;Main


Func _GuiRoundCorners($h_win,  $ixR, $iyR)
        Local $aPos = WinGetPos($h_win)
        If @error Then Return 0
        Local $iW = $aPos[2]
        Local $iH = $aPos[3]
        Local $hRgn = _WinAPI_CreateRoundRectRgn(0, 0, $iW, $iH, $ixR, $iyR)
        _WinAPI_SetWindowRgn($h_win, $hRgn)
EndFunc   ;==>_GuiRoundCorners

how to move window behind desktop icons ?

- Desktop icons are on the GUI
 
 
Posted

This works on my Win10 machine.

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

Global $hDeskWin = _WinGetDesktopHandle()
Global $h_Desktop_SysListView32 = HWnd(@extended)

Main()

Func Main()
    Local $this = GUICreate("", 400, 400, @DesktopWidth - (400) - 20, 100, $WS_POPUP, $WS_EX_NOACTIVATE + $WS_EX_TRANSPARENT)
    _WinAPI_SetParent($this, $h_Desktop_SysListView32)

    Local $iPic = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\Examples\GUI\msoobe.jpg", 0, 0, 400, 400)
    ;GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

    WinSetTrans($this, "", 200)
    _GuiRoundCorners($this, 16, 16)

    _WinAPI_SetWindowLong($this, $GWL_HWNDPARENT, ControlGetHandle("[CLASS:Progman]", "", "SysListView321")) ;hide in taskbar

    GUISetState(@SW_SHOWNOACTIVATE, $this)
    ;_WinAPI_SetWindowPos($this, $HWND_BOTTOM, Default, Default, Default, Default, BitOR($SWP_NOACTIVATE, $SWP_SHOWWINDOW, $SWP_NOMOVE, $SWP_NOSIZE )) ;not worked

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd
    GUIDelete($this)
EndFunc   ;==>Main


Func _GuiRoundCorners($h_win, $ixR, $iyR)
    Local $aPos = WinGetPos($h_win)
    If @error Then Return 0
    Local $iW = $aPos[2]
    Local $iH = $aPos[3]
    Local $hRgn = _WinAPI_CreateRoundRectRgn(0, 0, $iW, $iH, $ixR, $iyR)
    _WinAPI_SetWindowRgn($h_win, $hRgn)
EndFunc   ;==>_GuiRoundCorners



; http://www.autoitscript.com/forum/topic/119783-desktop-class-workerw/page__view__findpost__p__903081
; ===============================================================================================================================
; <_WinGetDesktopHandle.au3>
;
; Function to get the Windows' Desktop Handle.
;   Since this is no longer a simple '[CLASS:Progman]' on Aero-enabled desktops, this method uses a slightly
;   more involved method to find the correct Desktop Handle.
;
; Author: Ascend4nt, credits to Valik for pointing out the Parent->Child relationship: Desktop->'SHELLDLL_DefView'
; ===============================================================================================================================
; Example use:
#cs
    #include <GuiListView.au3>
    $iTimer = TimerInit()
    $hDeskWin = _WinGetDesktopHandle()
    $hListView = HWnd(@extended)
    ConsoleWrite("Time elapsed:" & TimerDiff($iTimer) & " ms" & @CRLF)
    $iDeskItems = _GUICtrlListView_GetItemCount($hListView)
    ConsoleWrite("Handle to desktop: " & $hDeskWin & ", Title: '" & WinGetTitle($hDeskWin) & "', Handle to Listview: " & $hListView & ", # Items:" & $iDeskItems & ", Title: " & WinGetTitle($hListView) & @CRLF)
    MsgBox(0, "Desktop handle (with ListView) found", "Handle to desktop: " & $hDeskWin & ", Title: '" & WinGetTitle($hDeskWin) & "'," & @CRLF & "Handle to Listview: " & $hListView & @CRLF & "# Desktop Items:" & $iDeskItems)
#ce
Func _WinGetDesktopHandle()
    Local $i, $hDeskWin, $hSHELLDLL_DefView, $hListView
    ; The traditional Windows Classname for the Desktop, not always so on newer O/S's
    $hDeskWin = WinGetHandle("[CLASS:Progman]")
    ; Parent->Child relationship: Desktop->SHELLDLL_DefView
    $hSHELLDLL_DefView = ControlGetHandle($hDeskWin, '', '[CLASS:SHELLDLL_DefView; INSTANCE:1]')
    ; No luck with finding the Desktop and/or child?
    If $hDeskWin = '' Or $hSHELLDLL_DefView = '' Then
        ; Look through a list of WorkerW windows - one will be the Desktop on Windows 7+ O/S's
        $aWinList = WinList("[CLASS:WorkerW]")
        For $i = 1 To $aWinList[0][0]
            $hSHELLDLL_DefView = ControlGetHandle($aWinList[$i][1], '', '[CLASS:SHELLDLL_DefView; INSTANCE:1]')
            If $hSHELLDLL_DefView <> '' Then
                $hDeskWin = $aWinList[$i][1]
                ExitLoop
            EndIf
        Next
    EndIf
    ; Parent->Child relationship: Desktop->SHELDLL_DefView->SysListView32
    $hListView = ControlGetHandle($hSHELLDLL_DefView, '', '[CLASS:SysListView32; INSTANCE:1]')
    If $hListView = '' Then Return SetError(-1, 0, '')
    Return SetExtended($hListView, $hDeskWin)
EndFunc   ;==>_WinGetDesktopHandle

 

 

Posted (edited)
23 hours ago, KaFu said:

This works on my Win10 machine.

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

Global $hDeskWin = _WinGetDesktopHandle()
Global $h_Desktop_SysListView32 = HWnd(@extended)

Main()

Func Main()
    Local $this = GUICreate("", 400, 400, @DesktopWidth - (400) - 20, 100, $WS_POPUP, $WS_EX_NOACTIVATE + $WS_EX_TRANSPARENT)
    _WinAPI_SetParent($this, $h_Desktop_SysListView32)

    Local $iPic = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\Examples\GUI\msoobe.jpg", 0, 0, 400, 400)
    ;GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

    WinSetTrans($this, "", 200)
    _GuiRoundCorners($this, 16, 16)

    _WinAPI_SetWindowLong($this, $GWL_HWNDPARENT, ControlGetHandle("[CLASS:Progman]", "", "SysListView321")) ;hide in taskbar

    GUISetState(@SW_SHOWNOACTIVATE, $this)
    ;_WinAPI_SetWindowPos($this, $HWND_BOTTOM, Default, Default, Default, Default, BitOR($SWP_NOACTIVATE, $SWP_SHOWWINDOW, $SWP_NOMOVE, $SWP_NOSIZE )) ;not worked

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd
    GUIDelete($this)
EndFunc   ;==>Main


Func _GuiRoundCorners($h_win, $ixR, $iyR)
    Local $aPos = WinGetPos($h_win)
    If @error Then Return 0
    Local $iW = $aPos[2]
    Local $iH = $aPos[3]
    Local $hRgn = _WinAPI_CreateRoundRectRgn(0, 0, $iW, $iH, $ixR, $iyR)
    _WinAPI_SetWindowRgn($h_win, $hRgn)
EndFunc   ;==>_GuiRoundCorners



; http://www.autoitscript.com/forum/topic/119783-desktop-class-workerw/page__view__findpost__p__903081
; ===============================================================================================================================
; <_WinGetDesktopHandle.au3>
;
; Function to get the Windows' Desktop Handle.
;   Since this is no longer a simple '[CLASS:Progman]' on Aero-enabled desktops, this method uses a slightly
;   more involved method to find the correct Desktop Handle.
;
; Author: Ascend4nt, credits to Valik for pointing out the Parent->Child relationship: Desktop->'SHELLDLL_DefView'
; ===============================================================================================================================
; Example use:
#cs
    #include <GuiListView.au3>
    $iTimer = TimerInit()
    $hDeskWin = _WinGetDesktopHandle()
    $hListView = HWnd(@extended)
    ConsoleWrite("Time elapsed:" & TimerDiff($iTimer) & " ms" & @CRLF)
    $iDeskItems = _GUICtrlListView_GetItemCount($hListView)
    ConsoleWrite("Handle to desktop: " & $hDeskWin & ", Title: '" & WinGetTitle($hDeskWin) & "', Handle to Listview: " & $hListView & ", # Items:" & $iDeskItems & ", Title: " & WinGetTitle($hListView) & @CRLF)
    MsgBox(0, "Desktop handle (with ListView) found", "Handle to desktop: " & $hDeskWin & ", Title: '" & WinGetTitle($hDeskWin) & "'," & @CRLF & "Handle to Listview: " & $hListView & @CRLF & "# Desktop Items:" & $iDeskItems)
#ce
Func _WinGetDesktopHandle()
    Local $i, $hDeskWin, $hSHELLDLL_DefView, $hListView
    ; The traditional Windows Classname for the Desktop, not always so on newer O/S's
    $hDeskWin = WinGetHandle("[CLASS:Progman]")
    ; Parent->Child relationship: Desktop->SHELLDLL_DefView
    $hSHELLDLL_DefView = ControlGetHandle($hDeskWin, '', '[CLASS:SHELLDLL_DefView; INSTANCE:1]')
    ; No luck with finding the Desktop and/or child?
    If $hDeskWin = '' Or $hSHELLDLL_DefView = '' Then
        ; Look through a list of WorkerW windows - one will be the Desktop on Windows 7+ O/S's
        $aWinList = WinList("[CLASS:WorkerW]")
        For $i = 1 To $aWinList[0][0]
            $hSHELLDLL_DefView = ControlGetHandle($aWinList[$i][1], '', '[CLASS:SHELLDLL_DefView; INSTANCE:1]')
            If $hSHELLDLL_DefView <> '' Then
                $hDeskWin = $aWinList[$i][1]
                ExitLoop
            EndIf
        Next
    EndIf
    ; Parent->Child relationship: Desktop->SHELDLL_DefView->SysListView32
    $hListView = ControlGetHandle($hSHELLDLL_DefView, '', '[CLASS:SysListView32; INSTANCE:1]')
    If $hListView = '' Then Return SetError(-1, 0, '')
    Return SetExtended($hListView, $hDeskWin)
EndFunc   ;==>_WinGetDesktopHandle

 

 

Thanks you

The problem still persists. ☹️

Tested on Windows 10 Enterprise 22H2 19045.3324 and newer

Edited by Parsix
Posted

I think it's technically impossible to move a program window behind the desktop icons: The Windows desktop, including the icons placed on it, is the "most-background-layer" of the Windows GUI.

If you want to just see the desktop icons, make the program window transparent. Help File: "WinSetTrans"

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Posted
Posted

The code I posted above makes the GUI a child of the desktop (sticky) and even allows a click-through on the Icons (tested on Win10 and Win11). Maybe make it 99% transparent and additionally use a wall paper for the background design?

Posted
On 7/10/2025 at 1:57 AM, Parsix said:

how to move window behind desktop icons ?

3 hours ago, Nine said:

AFAIK, only way to put something behind the desktop icons is called wall paper. You could assemble the wall paper that you wish to (with GDI+, containing multiple images), save it to file, set it as WallPaper.

@Parsix, what @Nine said is what programs that show PC info do. What do you wanna do ?. The more explicit the better ( interact with it ?, just show info ? ).

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

Posted (edited)

Programming is a problem-solving challenge.
Exactly as in the example, I need to display an image under the desktop icons, unfortunately the icons are placed under the application and cause user objections. This image could be a local calendar display.
The idea of producing a unified background as suggested by "KaFu" was my first alternative solution, but I am looking for a solution to the problem as much as possible. For example, until some time ago, the code sample that "Nine" shared with the title "Create an Application Bar recognized by the system" was perhaps impossible.

Nine, that code sample was very usefull, thank you very much for that code. 🥰

 

I did not even see a standard function or solution for sending the application to the lowest display layer, such as the functions that keep the application in the highest display layer.

 

I'm just wondering why UEZ hasn't commented yet ?! He usually comes in with something magical like Superman.🤩😁

 

Edited by Parsix
Posted (edited)

I found a way in Win11 24H2

Spy++:

WorkerW.jpg
GUI-Behind-Icons.jpg

but I couldn't find a way to get WorkerW handle by searching from Progman.

I will continue tomorrow...

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 (edited)
17 minutes ago, Nine said:

@UEZ  You should use this line instead :

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

Doesn't work anyway on Win10 although it returns a valid handle for WorkerW

It provides one of the WorkerW handles, not the WorkerW handle under Progman. 😉

 

This works for me:

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

Global $hProgman = WinGetHandle("[CLASS:Progman]"), $hWorkerW, $i
$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 $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

 

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

I've come this far, I'm struggling to figure out how to set the transparency.
Testet in Win10 22H2

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

; Getting the right WorkerW window
Global $hWorkerW = _FindWorkerW_WithStyles()
ConsoleWrite("$hWorkerW=" & $hWorkerW & @CRLF)
If Not $hWorkerW Then Exit ConsoleWrite("! Error Could not find WorkerW window." & @CRLF)

Main()

Func Main()

    Local $this = GUICreate("", 400, 400, @DesktopWidth - (400) - 20, 100, $WS_POPUP, $WS_EX_NOACTIVATE)
;~  WinSetTrans($this, "", 200) ; not working
    GUISetBkColor(0x000000)
    Local $iPic = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\Examples\GUI\msoobe.jpg", 0, 0, 0, 0)
    GUISetState(@SW_SHOW)

    ; Changes the parent window
    _WinAPI_SetParent($this, $hWorkerW)

    WinSetTrans($this, "", 100)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd
    GUIDelete($this)

EndFunc   ;==>Main


Func _FindWorkerW_WithStyles($iWidth = @DesktopWidth, $iHeight = @DesktopHeight)
    ; Getting the right WorkerW window with criteria
    ; size: 1920, 1080
    ; visible: Yes
    ; style: Popup,Tool Window,Transparent
    Local $aList = WinList("[CLASS:WorkerW]")

    For $i = 1 To $aList[0][0]
        Local $hWnd = $aList[$i][1]
        If Not IsHWnd($hWnd) Then ContinueLoop

        ; Get visibility
        If Not BitAND(WinGetState($hWnd), 2) Then ContinueLoop

        ; Get position and size
        Local $aPos = WinGetPos($hWnd)
        If @error Then ContinueLoop
        If $aPos[2] <> $iWidth Or $aPos[3] <> $iHeight Then ContinueLoop

        ; Get styles
        Local $nStyle = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE)     ; $GWL_STYLE
        Local $nExStyle = _WinAPI_GetWindowLong($hWnd, $GWL_EXSTYLE) ; $GWL_EXSTYLE

        ; Check for required style flags
        If BitAND($nStyle, $WS_POPUP) = $WS_POPUP _
                And BitAND($nExStyle, $WS_EX_TOOLWINDOW) = $WS_EX_TOOLWINDOW _
                And BitAND($nExStyle, $WS_EX_TRANSPARENT) = $WS_EX_TRANSPARENT Then
            Return $hWnd
        EndIf
    Next
    Return 0 ; Not found
EndFunc   ;==>_FindWorkerW_WithStyles

 

Edited by ioa747
($iWidth = @DesktopWidth, $iHeight = @DesktopHeight)

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