|
|
|
Урок 3 |
Разложить все иконки на рабочем столе по порядку (один за другим).
|
Расположите на форме элемент CommandButton
Код:
Private Const LVA_ALIGNLEFT = &H1
Private Const LVM_ARRANGE = &H1016
Private Const GW_CHILD = 5
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
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
Public Function ArrangeDesktopIcons() As Boolean
Dim hWnd As Long
Dim RetVal As Long
'найти хэндл рабочего стола
hWnd = FindWindow("Progman", vbNullString)
hWnd = GetWindow(hWnd, GW_CHILD)
hWnd = GetWindow(hWnd, GW_CHILD)
'выстроить иконки
RetVal = SendMessage(hWnd, LVM_ARRANGE, LVA_ALIGNLEFT, 0)
ArrangeDesktopIcons = RetVal > 0
End Function
Private Sub Command1_Click()
|
В разделе Примеры, Вы можете скачать пример этого урока. |
|
Назад |
|
|