|
參考以下程式 Option Explicit 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 Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _ (ByVal hWndParent As Long, ByVal hWndChildAfter As Long, ByVal lpClassName _ As String, ByVal lpWindowName As String) As Long Private Const LVM_GETTITEMCOUNT& = (&H1000 + 4) Private Const LVM_SETITEMPOSITION& = (&H1000 + 15) Dim hdesk&, i&, icount&, X&, Y& Public Sub MoveIcons() hdesk = FindWindow("progman", vbNullString) hdesk = FindWindowEx(hdesk, 0, "shelldll_defview", vbNullString) hdesk = FindWindowEx(hdesk, 0, "syslistview32", vbNullString) icount = SendMessage(hdesk, LVM_GETTITEMCOUNT, 0, 0) '0 is "My Computer" For i = 0 To icount - 1 X = 12 * i * Cos(i * 3.1415926535 / 5#) + 400: Y = 12 * i * Sin(i * 3.1415926535 / 5#) + 300 'set the position parameters in pixel 'The wParam must be i Call SendMessage(hdesk, LVM_SETITEMPOSITION, i, ByVal CLng(X + Y * &H10000)) Next End Sub Private Sub Command1_Click() Call MoveIcons End Sub |
|||
|
|||
|
|||
|
|
|
如果對本站有任何建議,歡迎來信給Honey,我們會盡快給您答覆 |