Page 1 of 1

Win32 - Change viewmode of desktop icons

Posted: Fri Mar 03, 2006 4:54 am
by va!n
Code updated For 5.20+

AS the topic says, a way to find the desktop listview handle for changing / getting icons informations...

Code: Select all

; ---------------------------------------------------------
;
; Win32 - Change viewmode of desktop icons
; Code by Thorsten Will (Mr.Vain of Secretly! in 2006)
;
; ---------------------------------------------------------

#LVM_FIRST      = $1000
#LVM_SetView    = #LVM_FIRST + 142
#LV_View_List   = 3

#LVA_ALIGNLEFT  = $1
#LVA_ALIGNTOP   = $2
#LVA_DEFAULT    = $0
#LVA_SNAPTOGRID = $5

Procedure GetDesktopListViewHandle()
    Result = FindWindow_("ProgMan", 0)
    Result = GetWindow_ (Result, #GW_CHILD)
    Result = GetWindow_ (Result, #GW_CHILD)
    
    s$ = Space(40)
    GetClassName_(Result, @s$, 39);
    If s$ <> "SysListView32" : Result = 0 : EndIf
    ProcedureReturn Result
EndProcedure

; ---------- Change the icon viewmode ----------

;Debug SendMessage_(GetDesktopListViewHandle(), #LVM_SetView, #LV_View_List, 0)

;delay(5000)

; ---------- Small example, sorting all icons to the left desktop side ----------

Debug SendMessage_(GetDesktopListViewHandle(), #LVM_ARRANGE, #LVA_ALIGNLEFT, 0)

End