Private Declare Function GetWindow Lib "user32" _
(ByVal hwnd As Long, ByVal wCmd As Long) As Long Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _ (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) _ As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Const GW_CHILD = 5 Private Const LVA_ALIGNLEFT = &H1 Private Const LVM_ARRANGE = &H1016 'When you want to arrange the icons, use this code: Dim hWnd1 As Long Dim hWnd2 As Long Dim Ret As Long hWnd1 = FindWindow("Progman", vbNullString) hWnd2 = GetWindow(hWnd1, GW_CHILD) hWnd1 = GetWindow(hWnd2, GW_CHILD) Ret = SendMessage(hWnd1, LVM_ARRANGE, LVA_ALIGNLEFT, 0) The following code will arrange the icons on the current desktop to align the to the left side. Firstly, Declare this in the General Declarations section of the Form: |